summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect2.result
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/r/subselect2.result')
-rw-r--r--mysql-test/r/subselect2.result19
1 files changed, 19 insertions, 0 deletions
diff --git a/mysql-test/r/subselect2.result b/mysql-test/r/subselect2.result
index ed00e4ef684..7eff7f949a8 100644
--- a/mysql-test/r/subselect2.result
+++ b/mysql-test/r/subselect2.result
@@ -179,4 +179,23 @@ pk a b
SET optimizer_switch=@tmp_optimizer_switch;
DROP VIEW v1;
DROP TABLE t1,t2,t3;
+#
+# MDEV-567: Wrong result from a query with correlated subquery if ICP is allowed
+#
+CREATE TABLE t1 (a int, b int, INDEX idx(a));
+INSERT INTO t1 VALUES (9,0), (7,1), (1,9), (7,3), (2,1);
+CREATE TABLE t2 (a int, b int, INDEX idx(a));
+INSERT INTO t2 VALUES (2,1), (6,4), (7,6), (9,4);
+CREATE TABLE t3 (a int, b int);
+INSERT INTO t3 VALUES (1,0), (1,1), (1,3);
+SELECT * FROM t3
+WHERE a = (SELECT COUNT(DISTINCT t2.b) FROM t1, t2
+WHERE t1.a = t2.a AND t2.a BETWEEN 7 AND 9
+AND t3.b = t1.b
+GROUP BY t1.b);
+a b
+1 0
+1 1
+1 3
+DROP TABLE t1, t2, t3;
set optimizer_switch=@subselect2_test_tmp;