Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
696f82a8
Commit
696f82a8
authored
Sep 15, 2006
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-5.0
into shellback.(none):/home/msvensson/mysql/mysql-5.0
parents
a2a6791f
a1c85e65
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
51 additions
and
3 deletions
+51
-3
mysql-test/r/insert_select.result
mysql-test/r/insert_select.result
+10
-0
mysql-test/t/insert_select.test
mysql-test/t/insert_select.test
+18
-0
sql/sql_base.cc
sql/sql_base.cc
+14
-1
sql/sql_insert.cc
sql/sql_insert.cc
+9
-0
sql/sql_parse.cc
sql/sql_parse.cc
+0
-2
No files found.
mysql-test/r/insert_select.result
View file @
696f82a8
...
@@ -695,6 +695,16 @@ CREATE TABLE t2 (z int, y int);
...
@@ -695,6 +695,16 @@ CREATE TABLE t2 (z int, y int);
CREATE TABLE t3 (a int, b int);
CREATE TABLE t3 (a int, b int);
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
DROP TABLE IF EXISTS t1,t2,t3;
DROP TABLE IF EXISTS t1,t2,t3;
CREATE DATABASE bug21774_1;
CREATE DATABASE bug21774_2;
CREATE TABLE bug21774_1.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
CREATE TABLE bug21774_2.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
CREATE TABLE bug21774_1.t2(id VARCHAR(10) NOT NULL,label VARCHAR(255));
INSERT INTO bug21774_2.t1 SELECT t1.* FROM bug21774_1.t1;
use bug21774_1;
INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
DROP DATABASE bug21774_1;
DROP DATABASE bug21774_2;
CREATE DATABASE meow;
CREATE DATABASE meow;
CREATE TABLE table_target ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target2 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
CREATE TABLE table_target2 ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
...
...
mysql-test/t/insert_select.test
View file @
696f82a8
...
@@ -248,6 +248,24 @@ CREATE TABLE t3 (a int, b int);
...
@@ -248,6 +248,24 @@ CREATE TABLE t3 (a int, b int);
INSERT
INTO
t3
(
SELECT
x
,
y
FROM
t1
JOIN
t2
USING
(
y
)
WHERE
z
=
1
);
INSERT
INTO
t3
(
SELECT
x
,
y
FROM
t1
JOIN
t2
USING
(
y
)
WHERE
z
=
1
);
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
DROP
TABLE
IF
EXISTS
t1
,
t2
,
t3
;
#
# Bug #21774: Column count doesn't match value count at row x
#
CREATE
DATABASE
bug21774_1
;
CREATE
DATABASE
bug21774_2
;
CREATE
TABLE
bug21774_1
.
t1
(
id
VARCHAR
(
10
)
NOT
NULL
,
label
VARCHAR
(
255
));
CREATE
TABLE
bug21774_2
.
t1
(
id
VARCHAR
(
10
)
NOT
NULL
,
label
VARCHAR
(
255
));
CREATE
TABLE
bug21774_1
.
t2
(
id
VARCHAR
(
10
)
NOT
NULL
,
label
VARCHAR
(
255
));
INSERT
INTO
bug21774_2
.
t1
SELECT
t1
.*
FROM
bug21774_1
.
t1
;
use
bug21774_1
;
INSERT
INTO
bug21774_2
.
t1
SELECT
t1
.*
FROM
t1
;
DROP
DATABASE
bug21774_1
;
DROP
DATABASE
bug21774_2
;
#
#
# Bug #20989: View '(null).(null)' references invalid table(s)... on
# Bug #20989: View '(null).(null)' references invalid table(s)... on
# SQL SECURITY INVOKER
# SQL SECURITY INVOKER
...
...
sql/sql_base.cc
View file @
696f82a8
...
@@ -4453,7 +4453,20 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
...
@@ -4453,7 +4453,20 @@ bool setup_tables(THD *thd, Name_resolution_context *context,
uint
tablenr
=
0
;
uint
tablenr
=
0
;
DBUG_ENTER
(
"setup_tables"
);
DBUG_ENTER
(
"setup_tables"
);
context
->
table_list
=
context
->
first_name_resolution_table
=
tables
;
/*
Due to the various call paths that lead to setup_tables() it may happen
that context->table_list and context->first_name_resolution_table can be
NULL (this is typically done when creating TABLE_LISTs internally).
TODO:
Investigate all cases when this my happen, initialize the name resolution
context correctly in all those places, and remove the context reset below.
*/
if
(
!
context
->
table_list
||
!
context
->
first_name_resolution_table
)
{
/* Test whether the context is in a consistent state. */
DBUG_ASSERT
(
!
context
->
first_name_resolution_table
&&
!
context
->
table_list
);
context
->
table_list
=
context
->
first_name_resolution_table
=
tables
;
}
/*
/*
this is used for INSERT ... SELECT.
this is used for INSERT ... SELECT.
...
...
sql/sql_insert.cc
View file @
696f82a8
...
@@ -411,6 +411,15 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
...
@@ -411,6 +411,15 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
table
=
table_list
->
table
;
table
=
table_list
->
table
;
context
=
&
thd
->
lex
->
select_lex
.
context
;
context
=
&
thd
->
lex
->
select_lex
.
context
;
/*
These three asserts test the hypothesis that the resetting of the name
resolution context below is not necessary at all since the list of local
tables for INSERT always consists of one table.
*/
DBUG_ASSERT
(
!
table_list
->
next_local
);
DBUG_ASSERT
(
!
context
->
table_list
->
next_local
);
DBUG_ASSERT
(
!
context
->
first_name_resolution_table
->
next_name_resolution_table
);
/* Save the state of the current name resolution context. */
/* Save the state of the current name resolution context. */
ctx_state
.
save_state
(
context
,
table_list
);
ctx_state
.
save_state
(
context
,
table_list
);
...
...
sql/sql_parse.cc
View file @
696f82a8
...
@@ -3344,8 +3344,6 @@ end_with_restore_list:
...
@@ -3344,8 +3344,6 @@ end_with_restore_list:
DBUG_ASSERT
(
first_table
==
all_tables
&&
first_table
!=
0
);
DBUG_ASSERT
(
first_table
==
all_tables
&&
first_table
!=
0
);
if
((
res
=
insert_precheck
(
thd
,
all_tables
)))
if
((
res
=
insert_precheck
(
thd
,
all_tables
)))
break
;
break
;
/* Skip first table, which is the table we are inserting in */
select_lex
->
context
.
table_list
=
first_table
->
next_local
;
if
(
!
thd
->
locked_tables
&&
if
(
!
thd
->
locked_tables
&&
!
(
need_start_waiting
=
!
wait_if_global_read_lock
(
thd
,
0
,
1
)))
!
(
need_start_waiting
=
!
wait_if_global_read_lock
(
thd
,
0
,
1
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment