You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: mysql-test/r/derived_view.result
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1288,7 +1288,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1288
1288
3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 2 100.00 Using where
1289
1289
Warnings:
1290
1290
Note 1276 Field or reference 't.a' of SELECT #3 was resolved in SELECT #1
1291
-
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where ('j' < `test`.`t1`.`a`)))
1291
+
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 28 from `test`.`t3` where ('j' < `test`.`t1`.`a`) limit 1))
1292
1292
SELECT * FROM (SELECT * FROM t1) AS t
1293
1293
WHERE EXISTS (SELECT t2.a FROM t3 RIGHT JOIN t2 ON (t3.a = t2.a)
Copy file name to clipboardExpand all lines: mysql-test/r/subselect.result
+36-5Lines changed: 36 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -341,7 +341,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
341
341
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
342
342
Warnings:
343
343
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
344
-
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)))
344
+
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`) limit 1))
345
345
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
346
346
ERROR 23000: Column 'a' in field list is ambiguous
347
347
drop table t1,t2,t3;
@@ -1887,7 +1887,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1887
1887
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
1888
1888
Warnings:
1889
1889
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
1890
-
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
1890
+
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null) limit 1))))
1891
1891
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
1892
1892
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
@@ -2423,7 +2423,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2423
2423
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2424
2424
Warnings:
2425
2425
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
2426
-
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)))
2426
+
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`) limit 1))
2427
2427
drop table t1;
2428
2428
CREATE TABLE t1 (t1_a int);
2429
2429
INSERT INTO t1 VALUES (1);
@@ -4432,7 +4432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4432
4432
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
4433
4433
Warnings:
4434
4434
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
4435
-
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
4435
+
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`) limit 1))
4436
4436
EXPLAIN EXTENDED
4437
4437
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
4438
4438
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@@ -4444,7 +4444,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
4444
4444
Warnings:
4445
4445
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
4446
4446
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
4447
-
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
4447
+
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) limit 1))
4448
4448
DROP TABLE t1,t2;
4449
4449
create table t0(a int);
4450
4450
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7187,4 +7187,35 @@ id select_type table type possible_keys key key_len ref rows Extra
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_mat.result
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -2219,7 +2219,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2219
2219
3 MATERIALIZED t3 ALL NULL NULL NULL NULL 8 100.00
2220
2220
Warnings:
2221
2221
Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1
2222
-
Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`f1` = `test`.`t3`.`f3`))))
2222
+
Note 1003 select `test`.`t1`.`f1` AS `f1` from `test`.`t1` where <expr_cache><`test`.`t1`.`f1`>(exists(select 1 from `test`.`t2` semi join (`test`.`t3`) join `test`.`t3` where ((`test`.`t3`.`i3` = `test`.`t2`.`i2`) and (`test`.`t1`.`f1` = `test`.`t3`.`f3`)) limit 1))
2223
2223
# this checks the result set above
2224
2224
set @save_optimizer_switch= @@optimizer_switch;
2225
2225
set optimizer_switch= 'materialization=off,semijoin=off';
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_no_mat.result
+36-5Lines changed: 36 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -348,7 +348,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
348
348
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
349
349
Warnings:
350
350
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
351
-
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`)))
351
+
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where <expr_cache><`test`.`t6`.`clinic_uq`>(exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`) limit 1))
352
352
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
353
353
ERROR 23000: Column 'a' in field list is ambiguous
354
354
drop table t1,t2,t3;
@@ -1894,7 +1894,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1894
1894
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
1895
1895
Warnings:
1896
1896
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
1897
-
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null)))))
1897
+
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(<expr_cache><`test`.`tt`.`id`>(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null) limit 1))))
1898
1898
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
1899
1899
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
@@ -2430,7 +2430,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2430
2430
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2431
2431
Warnings:
2432
2432
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
2433
-
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`)))
2433
+
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where <expr_cache><`test`.`up`.`a`>(exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`) limit 1))
2434
2434
drop table t1;
2435
2435
CREATE TABLE t1 (t1_a int);
2436
2436
INSERT INTO t1 VALUES (1);
@@ -4436,7 +4436,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4436
4436
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
4437
4437
Warnings:
4438
4438
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
4439
-
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
4439
+
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`) limit 1))
4440
4440
EXPLAIN EXTENDED
4441
4441
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
4442
4442
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@@ -4448,7 +4448,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
4448
4448
Warnings:
4449
4449
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
4450
4450
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
4451
-
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))))
4451
+
Note 1003 select 2 AS `2` from `test`.`t1` where <expr_cache><`test`.`t1`.`a`>(exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) limit 1))
4452
4452
DROP TABLE t1,t2;
4453
4453
create table t0(a int);
4454
4454
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7184,6 +7184,37 @@ id select_type table type possible_keys key key_len ref rows Extra
Copy file name to clipboardExpand all lines: mysql-test/r/subselect_no_opts.result
+36-5Lines changed: 36 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -344,7 +344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
344
344
2 DEPENDENT SUBQUERY t7 eq_ref PRIMARY PRIMARY 4 test.t6.clinic_uq 1 100.00 Using index
345
345
Warnings:
346
346
Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1
347
-
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`))
347
+
Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t6` where exists(select 1 from `test`.`t7` where (`test`.`t7`.`uq` = `test`.`t6`.`clinic_uq`) limit 1)
348
348
select * from t1 where a= (select a from t2,t4 where t2.b=t4.b);
349
349
ERROR 23000: Column 'a' in field list is ambiguous
350
350
drop table t1,t2,t3;
@@ -1890,7 +1890,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
1890
1890
2 DEPENDENT SUBQUERY t1 eq_ref PRIMARY PRIMARY 4 test.tt.id 1 100.00 Using where; Using index
1891
1891
Warnings:
1892
1892
Note 1276 Field or reference 'test.tt.id' of SELECT #2 was resolved in SELECT #1
1893
-
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null))))
1893
+
Note 1003 select `test`.`tt`.`id` AS `id`,`test`.`tt`.`text` AS `text` from `test`.`t1` `tt` where (not(exists(select `test`.`t1`.`id` from `test`.`t1` where ((`test`.`t1`.`id` < 8) and (`test`.`t1`.`id` = `test`.`tt`.`id`)) having (`test`.`t1`.`id` is not null) limit 1)))
1894
1894
insert into t1 (id, text) values (1000, 'text1000'), (1001, 'text1001');
1895
1895
create table t2 (id int not null, text varchar(20) not null default '', primary key (id));
@@ -2426,7 +2426,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
2426
2426
2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 2 100.00 Using where
2427
2427
Warnings:
2428
2428
Note 1276 Field or reference 'test.up.a' of SELECT #2 was resolved in SELECT #1
2429
-
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`))
2429
+
Note 1003 select `test`.`up`.`a` AS `a`,`test`.`up`.`b` AS `b` from `test`.`t1` `up` where exists(select 1 from `test`.`t1` where (`test`.`t1`.`a` = `test`.`up`.`a`) limit 1)
2430
2430
drop table t1;
2431
2431
CREATE TABLE t1 (t1_a int);
2432
2432
INSERT INTO t1 VALUES (1);
@@ -4432,7 +4432,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra
4432
4432
2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 100.00 Using where
4433
4433
Warnings:
4434
4434
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
4435
-
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`))
4435
+
Note 1003 select 2 AS `2` from `test`.`t1` where exists(select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`) limit 1)
4436
4436
EXPLAIN EXTENDED
4437
4437
SELECT 2 FROM t1 WHERE EXISTS ((SELECT 1 FROM t2 WHERE t1.a=t2.a) UNION
4438
4438
(SELECT 1 FROM t2 WHERE t1.a = t2.a));
@@ -4444,7 +4444,7 @@ NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL
4444
4444
Warnings:
4445
4445
Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1
4446
4446
Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #1
4447
-
Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)))
4447
+
Note 1003 select 2 AS `2` from `test`.`t1` where exists((select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) union (select 1 from `test`.`t2` where (`test`.`t1`.`a` = `test`.`t2`.`a`)) limit 1)
4448
4448
DROP TABLE t1,t2;
4449
4449
create table t0(a int);
4450
4450
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
@@ -7182,5 +7182,36 @@ id select_type table type possible_keys key key_len ref rows Extra
0 commit comments