mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
Merge.
This commit is contained in:
@@ -1424,4 +1424,42 @@ a a c a a c b a d
|
||||
6 23 -1 NULL NULL NULL NULL NULL 5
|
||||
DROP VIEW v2,v3;
|
||||
DROP TABLE t1,t2,t3,t4,t5;
|
||||
#
|
||||
# LP bug #872735: derived used in a NOT IN subquery
|
||||
#
|
||||
CREATE TABLE t1 (b int NOT NULL);
|
||||
INSERT INTO t1 VALUES (9), (7);
|
||||
CREATE TABLE t2 (a int NOT NULL) ;
|
||||
INSERT INTO t2 VALUES (1), (2);
|
||||
CREATE TABLE t3 (
|
||||
a int NOT NULL , c int NOT NULL, d varchar(1) NOT NULL,
|
||||
KEY (c,a) , PRIMARY KEY (a)
|
||||
);
|
||||
INSERT INTO t3 VALUES
|
||||
(14,4,'a'), (15,7,'b'), (16,4,'c'), (17,1,'d'), (18,9,'e'),
|
||||
(19,4,'f'), (20,8,'g');
|
||||
SET SESSION optimizer_switch='derived_merge=on,subquery_cache=off';
|
||||
# The following two EXPLAINs must return the same execution plan
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 , t2
|
||||
WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM t3 t);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
2 DEPENDENT SUBQUERY t ref PRIMARY,c c 4 func 2 Using where; Using index
|
||||
EXPLAIN
|
||||
SELECT * FROM t1 , t2
|
||||
WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM (SELECT * FROM t3) t);
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 2
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join)
|
||||
2 DEPENDENT SUBQUERY t3 ref PRIMARY,c c 4 func 2 Using where; Using index
|
||||
SELECT * FROM t1 , t2
|
||||
WHERE (t2.a ,t1.b) NOT IN (SELECT DISTINCT c,a FROM (SELECT * FROM t3) t);
|
||||
b a
|
||||
9 1
|
||||
7 1
|
||||
9 2
|
||||
7 2
|
||||
DROP TABLE t1,t2,t3;
|
||||
set optimizer_switch=@exit_optimizer_switch;
|
||||
|
||||
Reference in New Issue
Block a user