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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
c7320830
Commit
c7320830
authored
Sep 24, 2019
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
outer references in subqueries in INSERT
remove inconsistent limitation
parent
173ae631
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
33 deletions
+29
-33
mysql-test/main/insert.result
mysql-test/main/insert.result
+16
-0
mysql-test/main/insert.test
mysql-test/main/insert.test
+13
-0
mysql-test/main/subselect.result
mysql-test/main/subselect.result
+0
-2
mysql-test/main/subselect.test
mysql-test/main/subselect.test
+0
-2
mysql-test/main/subselect_no_exists_to_in.result
mysql-test/main/subselect_no_exists_to_in.result
+0
-2
mysql-test/main/subselect_no_mat.result
mysql-test/main/subselect_no_mat.result
+0
-2
mysql-test/main/subselect_no_opts.result
mysql-test/main/subselect_no_opts.result
+0
-2
mysql-test/main/subselect_no_scache.result
mysql-test/main/subselect_no_scache.result
+0
-2
mysql-test/main/subselect_no_semijoin.result
mysql-test/main/subselect_no_semijoin.result
+0
-2
sql/sql_insert.cc
sql/sql_insert.cc
+0
-19
No files found.
mysql-test/main/insert.result
View file @
c7320830
...
...
@@ -751,3 +751,19 @@ REPLACE INTO v1 SET f = NULL;
ERROR 22007: Truncated incorrect DOUBLE value: 'foo'
DROP VIEW v1;
DROP TABLE t1;
create table t1 (a int default 5);
insert t1 values (1);
insert t1 values (a);
insert t1 values ((select a+1));
insert t1 set a=2;
insert t1 set a=a+2;
insert t1 set a=(select a+3);
select * from t1;
a
1
5
6
2
7
8
drop table t1;
mysql-test/main/insert.test
View file @
c7320830
...
...
@@ -612,3 +612,16 @@ CREATE VIEW v1 AS SELECT * FROM t1 WHERE f <=> 'foo' WITH CHECK OPTION;
REPLACE
INTO
v1
SET
f
=
NULL
;
DROP
VIEW
v1
;
DROP
TABLE
t1
;
#
# outer referencesin subqueries in INSERT
#
create
table
t1
(
a
int
default
5
);
insert
t1
values
(
1
);
insert
t1
values
(
a
);
insert
t1
values
((
select
a
+
1
));
insert
t1
set
a
=
2
;
insert
t1
set
a
=
a
+
2
;
insert
t1
set
a
=
(
select
a
+
3
);
select
*
from
t1
;
drop
table
t1
;
mysql-test/main/subselect.result
View file @
c7320830
...
...
@@ -682,8 +682,6 @@ x
3
11
11
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
ERROR 42S22: Unknown column 'x' in 'field list'
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
...
...
mysql-test/main/subselect.test
View file @
c7320830
...
...
@@ -394,8 +394,6 @@ select * from t1;
# After this, only data based on old t1 records should have been added.
INSERT
INTO
t1
(
x
)
select
(
SELECT
SUM
(
x
)
+
2
FROM
t1
)
FROM
t2
;
select
*
from
t1
;
--
error
ER_BAD_FIELD_ERROR
INSERT
DELAYED
INTO
t1
(
x
)
VALUES
((
SELECT
SUM
(
x
)
FROM
t2
));
let
$row_count_before
=
`SELECT COUNT(*) FROM t1`
;
INSERT
DELAYED
INTO
t1
(
x
)
VALUES
((
SELECT
SUM
(
a
)
FROM
t2
));
let
$wait_condition
=
SELECT
COUNT
(
*
)
<>
$row_count_before
FROM
t1
;
...
...
mysql-test/main/subselect_no_exists_to_in.result
View file @
c7320830
...
...
@@ -686,8 +686,6 @@ x
3
11
11
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
ERROR 42S22: Unknown column 'x' in 'field list'
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
...
...
mysql-test/main/subselect_no_mat.result
View file @
c7320830
...
...
@@ -689,8 +689,6 @@ x
3
11
11
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
ERROR 42S22: Unknown column 'x' in 'field list'
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
...
...
mysql-test/main/subselect_no_opts.result
View file @
c7320830
...
...
@@ -685,8 +685,6 @@ x
3
11
11
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
ERROR 42S22: Unknown column 'x' in 'field list'
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
...
...
mysql-test/main/subselect_no_scache.result
View file @
c7320830
...
...
@@ -688,8 +688,6 @@ x
3
11
11
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
ERROR 42S22: Unknown column 'x' in 'field list'
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
...
...
mysql-test/main/subselect_no_semijoin.result
View file @
c7320830
...
...
@@ -685,8 +685,6 @@ x
3
11
11
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(x) FROM t2));
ERROR 42S22: Unknown column 'x' in 'field list'
INSERT DELAYED INTO t1 (x) VALUES ((SELECT SUM(a) FROM t2));
select * from t1;
x
...
...
sql/sql_insert.cc
View file @
c7320830
...
...
@@ -1512,25 +1512,6 @@ bool mysql_prepare_insert(THD *thd, TABLE_LIST *table_list,
DBUG_RETURN
(
TRUE
);
if
(
thd
->
lex
->
handle_list_of_derived
(
table_list
,
DT_PREPARE
))
DBUG_RETURN
(
TRUE
);
/*
For subqueries in VALUES() we should not see the table in which we are
inserting (for INSERT ... SELECT this is done by changing table_list,
because INSERT ... SELECT share SELECT_LEX it with SELECT.
*/
if
(
!
select_insert
)
{
for
(
SELECT_LEX_UNIT
*
un
=
select_lex
->
first_inner_unit
();
un
;
un
=
un
->
next_unit
())
{
for
(
SELECT_LEX
*
sl
=
un
->
first_select
();
sl
;
sl
=
sl
->
next_select
())
{
sl
->
context
.
outer_context
=
0
;
}
}
}
if
(
duplic
==
DUP_UPDATE
)
{
...
...
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