summaryrefslogtreecommitdiff
path: root/mysql-test/t
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2017-10-06 17:52:35 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2018-01-10 16:58:04 +0100
commit9c9cf556a15af84f9133ef859b50596085f7ae8e (patch)
treeea02026b856606ba8c5c14734fffe8f4e6e04f67 /mysql-test/t
parenta9c55c0059351220674a1dd3d3bf8d4e884b3285 (diff)
downloadmariadb-git-9c9cf556a15af84f9133ef859b50596085f7ae8e.tar.gz
MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
Roll back to most general duplicate removing strategi in case of different stratagies for one position.
Diffstat (limited to 'mysql-test/t')
-rw-r--r--mysql-test/t/subselect.test28
1 files changed, 28 insertions, 0 deletions
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 50d9517043a..e6233e9de78 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -6033,3 +6033,31 @@ CREATE TABLE t2 (f2 INT, KEY(f2)) ENGINE=MyISAM;
INSERT t2 VALUES (6),(9);
SELECT (SELECT MAX(sq.f2) FROM t1) FROM (SELECT * FROM t2) AS sq WHERE f2 = 2;
drop table t1, t2;
+
+--echo #
+--echo # MDEV-13933: Wrong results in COUNT() query with EXISTS and exists_to_in
+--echo # (5.5 test)
+--echo #
+SET @optimiser_switch_save= @@optimizer_switch;
+
+CREATE TABLE t1 (a INT NOT NULL);
+INSERT INTO t1 VALUES (1),(1),(1),(5),(5);
+
+CREATE TABLE t2 (b INT);
+INSERT INTO t2 VALUES (5),(1);
+
+CREATE TABLE t3 (c INT, KEY(c));
+INSERT INTO t3 VALUES (5),(5);
+
+SET optimizer_switch='semijoin=on';
+select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
+and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
+
+SET optimizer_switch='semijoin=off';
+select t1.a from t1 where t1.a in (select `test`.`t2`.`b` from `test`.`t2`)
+and t1.a in (select `test`.`t3`.`c` from `test`.`t3`);
+
+SET @@optimizer_switch= @optimiser_switch_save;
+DROP TABLE t1, t2, t3;
+
+--echo End of 5.5 tests