Commit 4b791936 authored by Igor Babaev's avatar Igor Babaev

Back-ported the test case for bug #12616253 from mariadb-5.3 that

was actually a duplicate of LP bug #888456 fixed in mariadb-5.2.
parent 4de7978a
......@@ -5155,4 +5155,45 @@ id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY t1 ALL NULL NULL NULL NULL 4
2 SUBQUERY t1 ref a a 5 const 1 Using where; Using index
DROP TABLE t1;
#
# BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
# (duplicate of LP bug #888456)
CREATE TABLE t1 (f1 varchar(1));
INSERT INTO t1 VALUES ('v'),('s');
CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key));
INSERT INTO t2 VALUES ('j'),('v'),('c'),('m'),('d'),
('d'),('y'),('t'),('d'),('s');
EXPLAIN
SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY table1 ALL NULL NULL NULL NULL 2
1 PRIMARY table2 index NULL f1_key 4 NULL 10 Using where; Using index; Using join buffer
2 DEPENDENT SUBQUERY t2 index f1_key f1_key 4 NULL 10 Using where; Using index; Using temporary
SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
f1 f1_key
v j
s j
v v
s v
v c
s c
v m
s m
v d
s d
v d
s d
v y
s y
v t
s t
v d
s d
v s
s s
DROP TABLE t1,t2;
End of 5.2 tests
......@@ -4022,4 +4022,25 @@ EXPLAIN SELECT * FROM t1 WHERE EXISTS (SELECT * FROM t1 WHERE a=7);
DROP TABLE t1;
--echo #
--echo # BUG#12616253 - WRONG RESULT WITH EXISTS(SUBQUERY) (MISSING ROWS)
--echo # (duplicate of LP bug #888456)
CREATE TABLE t1 (f1 varchar(1));
INSERT INTO t1 VALUES ('v'),('s');
CREATE TABLE t2 (f1_key varchar(1), KEY (f1_key));
INSERT INTO t2 VALUES ('j'),('v'),('c'),('m'),('d'),
('d'),('y'),('t'),('d'),('s');
EXPLAIN
SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
SELECT table1.f1, table2.f1_key FROM t1 AS table1, t2 AS table2
WHERE EXISTS (SELECT DISTINCT f1_key FROM t2
WHERE f1_key != table2.f1_key AND f1_key >= table1.f1);
DROP TABLE t1,t2;
--echo End of 5.2 tests
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment