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
2ae8dc24
Commit
2ae8dc24
authored
Mar 09, 2023
by
Igor Babaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adjusted test results after rebase against 11.0.1
parent
12840543
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
3128 additions
and
1114 deletions
+3128
-1114
mysql-test/main/delete.result
mysql-test/main/delete.result
+2
-4
mysql-test/main/delete_single_to_multi.result
mysql-test/main/delete_single_to_multi.result
+1252
-239
mysql-test/main/delete_single_to_multi.test
mysql-test/main/delete_single_to_multi.test
+110
-86
mysql-test/main/derived_cond_pushdown.result
mysql-test/main/derived_cond_pushdown.result
+2
-13
mysql-test/main/log_state.result
mysql-test/main/log_state.result
+1
-1
mysql-test/main/multi_update.result
mysql-test/main/multi_update.result
+1
-0
mysql-test/main/myisam_explain_non_select_all.result
mysql-test/main/myisam_explain_non_select_all.result
+10
-14
mysql-test/main/opt_trace.result
mysql-test/main/opt_trace.result
+2
-2
mysql-test/main/subselect.result
mysql-test/main/subselect.result
+12
-0
mysql-test/main/subselect.test
mysql-test/main/subselect.test
+6
-0
mysql-test/main/subselect_no_exists_to_in.result
mysql-test/main/subselect_no_exists_to_in.result
+12
-0
mysql-test/main/subselect_no_mat.result
mysql-test/main/subselect_no_mat.result
+12
-0
mysql-test/main/subselect_no_opts.result
mysql-test/main/subselect_no_opts.result
+12
-0
mysql-test/main/subselect_no_scache.result
mysql-test/main/subselect_no_scache.result
+12
-0
mysql-test/main/subselect_no_semijoin.result
mysql-test/main/subselect_no_semijoin.result
+12
-0
mysql-test/main/update_single_to_multi.result
mysql-test/main/update_single_to_multi.result
+1574
-699
mysql-test/main/update_single_to_multi.test
mysql-test/main/update_single_to_multi.test
+93
-54
mysql-test/main/update_use_source.result
mysql-test/main/update_use_source.result
+1
-1
sql/sql_select.cc
sql/sql_select.cc
+2
-1
No files found.
mysql-test/main/delete.result
View file @
2ae8dc24
...
@@ -583,8 +583,7 @@ explain delete from t1
...
@@ -583,8 +583,7 @@ explain delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1)
2 MATERIALIZED a ALL NULL NULL NULL NULL 8
delete from t1
delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
select *from t1;
select *from t1;
...
@@ -600,8 +599,7 @@ where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3
...
@@ -600,8 +599,7 @@ where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3
order by c2;
order by c2;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY a ALL NULL NULL NULL NULL 8 Using where; FirstMatch(t1)
2 MATERIALIZED a ALL NULL NULL NULL NULL 8
delete from t1
delete from t1
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3
where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3
order by c2;
order by c2;
...
...
mysql-test/main/delete_single_to_multi.result
View file @
2ae8dc24
This diff is collapsed.
Click to expand it.
mysql-test/main/delete_single_to_multi.test
View file @
2ae8dc24
This diff is collapsed.
Click to expand it.
mysql-test/main/derived_cond_pushdown.result
View file @
2ae8dc24
...
@@ -13134,20 +13134,7 @@ EXPLAIN
...
@@ -13134,20 +13134,7 @@ EXPLAIN
"materialized": {
"materialized": {
"query_block": {
"query_block": {
"select_id": 3,
"select_id": 3,
<<<<<<< 2ad65c4dbcb291867725d50d1f53c8da8549afb3
"cost": "COST_REPLACED",
"cost": "COST_REPLACED",
"nested_loop": [
{
"table": {
"table_name": "t1",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"attached_condition": "t1.f2 < 2"
}
=======
"filesort": {
"filesort": {
"sort_key": "t1.f2",
"sort_key": "t1.f2",
"temporary_table": {
"temporary_table": {
...
@@ -13156,7 +13143,9 @@ EXPLAIN
...
@@ -13156,7 +13143,9 @@ EXPLAIN
"table": {
"table": {
"table_name": "t1",
"table_name": "t1",
"access_type": "ALL",
"access_type": "ALL",
"loops": 1,
"rows": 2,
"rows": 2,
"cost": "COST_REPLACED",
"filtered": 100,
"filtered": 100,
"attached_condition": "t1.f2 < 2"
"attached_condition": "t1.f2 < 2"
}
}
...
...
mysql-test/main/log_state.result
View file @
2ae8dc24
...
@@ -243,7 +243,7 @@ rows_examined sql_text
...
@@ -243,7 +243,7 @@ rows_examined sql_text
4 UPDATE t1 SET a=a+sleep(.02) WHERE a>2
4 UPDATE t1 SET a=a+sleep(.02) WHERE a>2
8 UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC
8 UPDATE t1 SET a=a+sleep(.02) ORDER BY a DESC
1 UPDATE t2 set b=b+sleep(.02) limit 1
1 UPDATE t2 set b=b+sleep(.02) limit 1
10
UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2)
6
UPDATE t1 SET a=a+sleep(.02) WHERE a in (SELECT b from t2)
6 DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2
6 DELETE FROM t1 WHERE a=a+sleep(.02) ORDER BY a LIMIT 2
disconnect con2;
disconnect con2;
connection default;
connection default;
...
...
mysql-test/main/multi_update.result
View file @
2ae8dc24
...
@@ -1270,6 +1270,7 @@ DROP TABLES t1, t2;
...
@@ -1270,6 +1270,7 @@ DROP TABLES t1, t2;
# End of 10.3 tests
# End of 10.3 tests
#
#
# MDEV-30538: multi-table UPDATE/DELETE with possible exists-to-in
# MDEV-30538: multi-table UPDATE/DELETE with possible exists-to-in
#
create table t1 (c1 int, c2 int, c3 int, index idx(c2));
create table t1 (c1 int, c2 int, c3 int, index idx(c2));
insert into t1 values
insert into t1 values
(1,1,1),(3,2,2),(1,3,3),
(1,1,1),(3,2,2),(1,3,3),
...
...
mysql-test/main/myisam_explain_non_select_all.result
View file @
2ae8dc24
...
@@ -218,16 +218,14 @@ INSERT INTO t2 VALUES (1), (2), (3);
...
@@ -218,16 +218,14 @@ INSERT INTO t2 VALUES (1), (2), (3);
#
#
EXPLAIN UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
EXPLAIN UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY
<subquery2> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY
t2 ALL NULL NULL NULL NULL 3 Using where; FirstMatch
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 Using where
FLUSH STATUS;
FLUSH STATUS;
FLUSH TABLES;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE 1 IN (SELECT 1 FROM t2 WHERE t2.b < 3);
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY
<subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
1 PRIMARY
t2 ALL NULL NULL NULL NULL 3 33.33 Using where; FirstMatch
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00 Using where
# Status of EXPLAIN EXTENDED query
# Status of EXPLAIN EXTENDED query
Variable_name Value
Variable_name Value
Handler_read_key 4
Handler_read_key 4
...
@@ -248,9 +246,9 @@ Handler_read_key 4
...
@@ -248,9 +246,9 @@ Handler_read_key 4
Handler_read_rnd_next 5
Handler_read_rnd_next 5
# Status of testing query execution:
# Status of testing query execution:
Variable_name Value
Variable_name Value
Handler_read_key
5
Handler_read_key
4
Handler_read_rnd 3
Handler_read_rnd 3
Handler_read_rnd_next
12
Handler_read_rnd_next
9
Handler_update 3
Handler_update 3
DROP TABLE t1, t2;
DROP TABLE t1, t2;
...
@@ -904,15 +902,13 @@ INSERT INTO t2 VALUES (1), (2), (3), (1000);
...
@@ -904,15 +902,13 @@ INSERT INTO t2 VALUES (1), (2), (3), (1000);
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
1 PRIMARY t1 ALL NULL NULL NULL NULL 3
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 Using where; FirstMatch(t1)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3
FLUSH STATUS;
FLUSH STATUS;
FLUSH TABLES;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT a FROM t2);
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00
1 PRIMARY <subquery2> eq_ref distinct_key distinct_key 4 func 1 100.00
1 PRIMARY t2 ALL NULL NULL NULL NULL 4 100.00 Using where; FirstMatch(t1)
2 MATERIALIZED t2 ALL NULL NULL NULL NULL 3 100.00
# Status of EXPLAIN EXTENDED query
# Status of EXPLAIN EXTENDED query
Variable_name Value
Variable_name Value
Handler_read_key 4
Handler_read_key 4
...
@@ -933,8 +929,8 @@ Handler_read_key 4
...
@@ -933,8 +929,8 @@ Handler_read_key 4
Handler_read_rnd_next 9
Handler_read_rnd_next 9
# Status of testing query execution:
# Status of testing query execution:
Variable_name Value
Variable_name Value
Handler_read_key
7
Handler_read_key
4
Handler_read_rnd_next
8
Handler_read_rnd_next
10
Handler_update 3
Handler_update 3
DROP TABLE t1, t2;
DROP TABLE t1, t2;
...
@@ -2828,14 +2824,14 @@ INSERT INTO t2 VALUES (1), (2), (3);
...
@@ -2828,14 +2824,14 @@ INSERT INTO t2 VALUES (1), (2), (3);
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x);
EXPLAIN UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x);
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 Using where
1 PRIMARY <derived3>
ref key0 key0 5 test.t1.a 2 FirstMatch(t1)
1 PRIMARY <derived3>
eq_ref distinct_key distinct_key 5 test.t1.a 1
3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort
3 DERIVED t2 ALL NULL NULL NULL NULL 3 Using filesort
FLUSH STATUS;
FLUSH STATUS;
FLUSH TABLES;
FLUSH TABLES;
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x);
EXPLAIN EXTENDED UPDATE t1 SET a = 10 WHERE a IN (SELECT * FROM (SELECT b FROM t2 ORDER BY b LIMIT 2,2) x);
id select_type table type possible_keys key key_len ref rows filtered Extra
id select_type table type possible_keys key key_len ref rows filtered Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where
1 PRIMARY <derived3>
ref key0 key0 5 test.t1.a 2 100.00 FirstMatch(t1)
1 PRIMARY <derived3>
eq_ref distinct_key distinct_key 5 test.t1.a 1 100.00
3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort
3 DERIVED t2 ALL NULL NULL NULL NULL 3 100.00 Using filesort
# Status of EXPLAIN EXTENDED query
# Status of EXPLAIN EXTENDED query
Variable_name Value
Variable_name Value
...
...
mysql-test/main/opt_trace.result
View file @
2ae8dc24
...
@@ -4495,7 +4495,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
...
@@ -4495,7 +4495,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rowid_filters": [
"rowid_filters": [
{
{
"key": "a",
"key": "a",
"build_cost": 0.
174715752
,
"build_cost": 0.
001129926
,
"rows": 3
"rows": 3
}
}
]
]
...
@@ -4570,7 +4570,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
...
@@ -4570,7 +4570,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
"rowid_filters": [
"rowid_filters": [
{
{
"key": "a",
"key": "a",
"build_cost": 0.
174715752
,
"build_cost": 0.
001129926
,
"rows": 3
"rows": 3
}
}
]
]
...
...
mysql-test/main/subselect.result
View file @
2ae8dc24
...
@@ -634,6 +634,18 @@ a b
...
@@ -634,6 +634,18 @@ a b
22 11
22 11
2 12
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
...
...
mysql-test/main/subselect.test
View file @
2ae8dc24
...
@@ -387,6 +387,12 @@ insert into t2 values (1, 21),(2, 12),(3, 23);
...
@@ -387,6 +387,12 @@ insert into t2 values (1, 21),(2, 12),(3, 23);
select
*
from
t11
;
select
*
from
t11
;
select
*
from
t12
;
select
*
from
t12
;
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t12
where
t11
.
a
=
t12
.
a
);
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t12
where
t11
.
a
=
t12
.
a
);
select
*
from
t11
;
select
*
from
t12
;
delete
from
t11
;
delete
from
t12
;
insert
into
t11
values
(
0
,
10
),(
1
,
11
),(
2
,
12
);
insert
into
t12
values
(
33
,
10
),(
22
,
11
),(
2
,
12
);
--
error
ER_SUBQUERY_NO_1_ROW
--
error
ER_SUBQUERY_NO_1_ROW
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t2
);
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t2
);
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t2
where
t11
.
a
=
t2
.
a
);
delete
t11
.*
,
t12
.*
from
t11
,
t12
where
t11
.
a
=
t12
.
a
and
t11
.
b
=
(
select
b
from
t2
where
t11
.
a
=
t2
.
a
);
...
...
mysql-test/main/subselect_no_exists_to_in.result
View file @
2ae8dc24
...
@@ -638,6 +638,18 @@ a b
...
@@ -638,6 +638,18 @@ a b
22 11
22 11
2 12
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
...
...
mysql-test/main/subselect_no_mat.result
View file @
2ae8dc24
...
@@ -641,6 +641,18 @@ a b
...
@@ -641,6 +641,18 @@ a b
22 11
22 11
2 12
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
...
...
mysql-test/main/subselect_no_opts.result
View file @
2ae8dc24
...
@@ -637,6 +637,18 @@ a b
...
@@ -637,6 +637,18 @@ a b
22 11
22 11
2 12
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
...
...
mysql-test/main/subselect_no_scache.result
View file @
2ae8dc24
...
@@ -640,6 +640,18 @@ a b
...
@@ -640,6 +640,18 @@ a b
22 11
22 11
2 12
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
...
...
mysql-test/main/subselect_no_semijoin.result
View file @
2ae8dc24
...
@@ -637,6 +637,18 @@ a b
...
@@ -637,6 +637,18 @@ a b
22 11
22 11
2 12
2 12
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t12 where t11.a = t12.a);
select * from t11;
a b
0 10
1 11
select * from t12;
a b
33 10
22 11
delete from t11;
delete from t12;
insert into t11 values (0, 10),(1, 11),(2, 12);
insert into t12 values (33, 10),(22, 11),(2, 12);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2);
ERROR 21000: Subquery returns more than 1 row
ERROR 21000: Subquery returns more than 1 row
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
delete t11.*, t12.* from t11,t12 where t11.a = t12.a and t11.b = (select b from t2 where t11.a = t2.a);
...
...
mysql-test/main/update_single_to_multi.result
View file @
2ae8dc24
This diff is collapsed.
Click to expand it.
mysql-test/main/update_single_to_multi.test
View file @
2ae8dc24
...
@@ -15,8 +15,9 @@ use dbt3_s001;
...
@@ -15,8 +15,9 @@ use dbt3_s001;
--
enable_query_log
--
enable_query_log
create
index
i_n_name
on
nation
(
n_name
);
create
index
i_n_name
on
nation
(
n_name
);
analyze
table
nation
;
analyze
table
nation
,
lineitem
,
customer
,
orders
,
part
,
supplier
,
partsupp
,
region
persistent
for
all
;
--
echo
# Pullout
--
echo
# Pullout
--
echo
# =======
--
echo
# =======
...
@@ -209,117 +210,148 @@ select c_name, c_acctbal from customer where $c6;
...
@@ -209,117 +210,148 @@ select c_name, c_acctbal from customer where $c6;
--
echo
# Materialization
--
echo
# Materialization
--
echo
# ===============
--
echo
# ===============
set
optimizer_switch
=
'firstmatch=off'
;
let
$c7
=
let
$c7
=
c_nationkey
in
(
select
n_nationkey
from
nation
where
n_name
in
(
'JAPAN'
,
'INDONESIA'
,
'PERU'
,
'ARGENTINA'
))
and
c_custkey
in
(
select
o_custkey
from
orders
c_custkey
in
(
select
o_custkey
from
orders
where
o_orderDATE
between
'1992-01-09'
and
'1992-03-08'
);
where
o_orderDATE
between
"1992-01-09"
and
"1995-01-08"
);
eval
eval
explain
explain
select
c_name
,
c_acctbal
from
customer
where
$c7
;
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
eval
explain
format
=
json
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c7
;
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
eval
explain
explain
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c7
;
update
customer
set
c_acctbal
=
c_acctbal
+
20
where
$c7
;
eval
eval
explain
format
=
json
update
customer
set
c_acctbal
=
c_acctbal
+
20
where
$c7
;
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c7
;
eval
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c7
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c7
;
select
c_name
,
c_acctbal
from
customer
where
$c7
;
eval
eval
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c7
;
update
customer
set
c_acctbal
=
c_acctbal
-
20
where
$c7
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c7
;
select
c_name
,
c_acctbal
from
customer
where
$c7
;
set
optimizer_switch
=
'firstmatch=default'
;
let
$c8
=
let
$c8
=
c_custkey
in
(
select
o_custkey
from
orders
c_custkey
in
(
select
o_custkey
from
orders
where
o_orderDATE
between
'1992-0
6-09'
and
'1993-01
-08'
);
where
o_orderDATE
between
'1992-0
1-09'
and
'1993-03
-08'
);
eval
eval
explain
explain
select
c_name
,
c_acctbal
from
customer
where
$c8
;
select
c_name
,
c_acctbal
from
customer
where
$c8
;
eval
eval
explain
format
=
json
select
c_name
,
c_acctbal
from
customer
where
$c8
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c8
;
select
c_name
,
c_acctbal
from
customer
where
$c8
;
eval
eval
explain
explain
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c8
;
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c8
;
eval
eval
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c8
;
explain
format
=
json
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c8
;
eval
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c8
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c8
;
select
c_name
,
c_acctbal
from
customer
where
$c8
;
eval
eval
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c8
;
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c8
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c8
;
select
c_name
,
c_acctbal
from
customer
where
$c8
;
let
$c9
=
c_custkey
in
(
select
o_custkey
from
orders
where
o_orderDATE
between
'1992-06-09'
and
'1993-01-08'
);
eval
explain
select
c_name
,
c_acctbal
from
customer
where
$c9
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c9
;
eval
explain
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c9
;
eval
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c9
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c9
;
eval
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c9
;
eval
select
c_name
,
c_acctbal
from
customer
where
$c9
;
--
echo
# Materialization SJM
--
echo
# Materialization SJM
--
echo
# ===================
--
echo
# ===================
let
$c
9
=
let
$c
10
=
c_custkey
in
(
select
o_custkey
from
orders
c_custkey
in
(
select
o_custkey
from
orders
where
o_orderDATE
between
'1992-01-09'
and
'1992-03-08'
where
o_orderDATE
between
'1992-01-09'
and
'1992-03-08'
group
by
o_custkey
having
count
(
o_custkey
)
>
1
);
group
by
o_custkey
having
count
(
o_custkey
)
>
1
);
eval
eval
explain
explain
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
eval
explain
format
=
json
explain
format
=
json
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
eval
explain
explain
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
10
;
eval
eval
explain
format
=
json
explain
format
=
json
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
10
;
eval
eval
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
-
5
where
$c
10
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
eval
eval
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
+
5
where
$c
10
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
let
$c1
0
=
let
$c1
1
=
c_custkey
in
(
select
o_custkey
from
orders
c_custkey
in
(
select
o_custkey
from
orders
where
o_orderDATE
between
'1992-01-09'
and
'1993-03-08'
where
o_orderDATE
between
'1992-01-09'
and
'1993-03-08'
group
by
o_custkey
having
count
(
o_custkey
)
>
5
);
group
by
o_custkey
having
count
(
o_custkey
)
>
5
);
eval
eval
explain
explain
select
c_name
,
c_acctbal
from
customer
where
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
eval
eval
explain
explain
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
0
;
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
1
;
eval
eval
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
0
;
update
customer
set
c_acctbal
=
c_acctbal
-
1
where
$c1
1
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
eval
eval
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c1
0
;
update
customer
set
c_acctbal
=
c_acctbal
+
1
where
$c1
1
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c1
0
;
select
c_name
,
c_acctbal
from
customer
where
$c1
1
;
--
echo
# Pullout PS
--
echo
# Pullout PS
...
@@ -350,6 +382,8 @@ deallocate prepare stmt;
...
@@ -350,6 +382,8 @@ deallocate prepare stmt;
--
echo
# FirstMatch PS
--
echo
# FirstMatch PS
--
echo
# =============
--
echo
# =============
set
optimizer_switch
=
'materialization=off'
;
eval
eval
prepare
stmt
from
"
prepare
stmt
from
"
update customer set c_acctbal = c_acctbal+? where
$c5
;
update customer set c_acctbal = c_acctbal+? where
$c5
;
...
@@ -371,28 +405,29 @@ select c_name, c_acctbal from customer where $c5;
...
@@ -371,28 +405,29 @@ select c_name, c_acctbal from customer where $c5;
deallocate
prepare
stmt
;
deallocate
prepare
stmt
;
set
optimizer_switch
=
'materialization=default'
;
--
echo
# Materialization PS
--
echo
# Materialization PS
--
echo
# ==================
--
echo
# ==================
eval
eval
prepare
stmt
from
"
prepare
stmt
from
"
update customer set c_acctbal = c_acctbal+? where
$c
7
;
update customer set c_acctbal = c_acctbal+? where
$c
8
;
"
;
"
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
set
@
a1
=
7
;
set
@
a1
=
7
;
execute
stmt
using
@
a1
;
execute
stmt
using
@
a1
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
set
@
a2
=
3
;
set
@
a2
=
3
;
execute
stmt
using
@
a2
;
execute
stmt
using
@
a2
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
execute
stmt
using
-
(
@
a1
+@
a2
);
execute
stmt
using
-
(
@
a1
+@
a2
);
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
deallocate
prepare
stmt
;
deallocate
prepare
stmt
;
...
@@ -402,22 +437,22 @@ deallocate prepare stmt;
...
@@ -402,22 +437,22 @@ deallocate prepare stmt;
eval
eval
prepare
stmt
from
"
prepare
stmt
from
"
update customer set c_acctbal = c_acctbal+? where
$c
9
;
update customer set c_acctbal = c_acctbal+? where
$c
10
;
"
;
"
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
set
@
a1
=-
2
;
set
@
a1
=-
2
;
execute
stmt
using
@
a1
;
execute
stmt
using
@
a1
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
set
@
a2
=-
1
;
set
@
a2
=-
1
;
execute
stmt
using
@
a2
;
execute
stmt
using
@
a2
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
execute
stmt
using
-
(
@
a1
+@
a2
);
execute
stmt
using
-
(
@
a1
+@
a2
);
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
deallocate
prepare
stmt
;
deallocate
prepare
stmt
;
...
@@ -447,6 +482,8 @@ drop procedure p;
...
@@ -447,6 +482,8 @@ drop procedure p;
--
echo
# FirstMatch SP
--
echo
# FirstMatch SP
--
echo
# =============
--
echo
# =============
set
optimizer_switch
=
'materialization=off'
;
eval
eval
create
procedure
p
(
d
int
)
create
procedure
p
(
d
int
)
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c5
;
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c5
;
...
@@ -465,25 +502,27 @@ select c_name, c_acctbal from customer where $c5;
...
@@ -465,25 +502,27 @@ select c_name, c_acctbal from customer where $c5;
drop
procedure
p
;
drop
procedure
p
;
set
optimizer_switch
=
'materialization=default'
;
--
echo
# Materialization SP
--
echo
# Materialization SP
--
echo
# ==================
--
echo
# ==================
eval
eval
create
procedure
p
(
d
int
)
create
procedure
p
(
d
int
)
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
7
;
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
8
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
call
p
(
3
);
call
p
(
3
);
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
call
p
(
7
);
call
p
(
7
);
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
call
p
(
-
(
3
+
7
));
call
p
(
-
(
3
+
7
));
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
7
;
select
c_name
,
c_acctbal
from
customer
where
$c
8
;
drop
procedure
p
;
drop
procedure
p
;
...
@@ -493,19 +532,19 @@ drop procedure p;
...
@@ -493,19 +532,19 @@ drop procedure p;
eval
eval
create
procedure
p
(
d
int
)
create
procedure
p
(
d
int
)
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
9
;
update
customer
set
c_acctbal
=
c_acctbal
+
d
where
$c
10
;
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
call
p
(
-
1
);
call
p
(
-
1
);
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
call
p
(
-
2
);
call
p
(
-
2
);
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
call
p
(
1
+
2
);
call
p
(
1
+
2
);
eval
eval
select
c_name
,
c_acctbal
from
customer
where
$c
9
;
select
c_name
,
c_acctbal
from
customer
where
$c
10
;
drop
procedure
p
;
drop
procedure
p
;
...
...
mysql-test/main/update_use_source.result
View file @
2ae8dc24
...
@@ -316,7 +316,7 @@ rollback;
...
@@ -316,7 +316,7 @@ rollback;
#
#
explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3;
explain update t1 set c1=0 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 > 3;
id select_type table type possible_keys key key_len ref rows Extra
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using
where
1 PRIMARY t1 range t1_c2 t1_c2 5 NULL 2 Using
index condition
1 PRIMARY a ref t1_c2 t1_c2 5 test.t1.c2 8 Using index; FirstMatch(t1)
1 PRIMARY a ref t1_c2 t1_c2 5 test.t1.c2 8 Using index; FirstMatch(t1)
start transaction;
start transaction;
update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
update t1 set c1=c1+10 where exists (select 'X' from t1 a where a.c2 = t1.c2) and c2 >= 3;
...
...
sql/sql_select.cc
View file @
2ae8dc24
...
@@ -32592,7 +32592,8 @@ bool Sql_cmd_dml::execute_inner(THD *thd)
...
@@ -32592,7 +32592,8 @@ bool Sql_cmd_dml::execute_inner(THD *thd)
if (unlikely(thd->is_error()))
if (unlikely(thd->is_error()))
goto err;
goto err;
join->exec();
if (join->exec())
goto err;
if (thd->lex->describe & DESCRIBE_EXTENDED)
if (thd->lex->describe & DESCRIBE_EXTENDED)
{
{
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