summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2012-01-14 00:02:02 -0800
committerIgor Babaev <igor@askmonty.org>2012-01-14 00:02:02 -0800
commit4b7919368ebd14ec09eef1e8508ebbab71b86e0c (patch)
tree56e9ef7fdaf749dee7d59f744af99956591f26a4 /mysql-test/t/subselect.test
parent4de7978a3f3e716a6b1b280ce1f30dd501e31545 (diff)
downloadmariadb-git-4b7919368ebd14ec09eef1e8508ebbab71b86e0c.tar.gz
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.
Diffstat (limited to 'mysql-test/t/subselect.test')
-rw-r--r--mysql-test/t/subselect.test21
1 files changed, 21 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 1f3c102770c..24aad3a145d 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -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