summaryrefslogtreecommitdiff
path: root/mysql-test/main/intersect.test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-03-11 17:10:20 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2019-03-11 17:41:00 +0100
commit6d68a3464e9a93baecc277a2c270cad28fbf50bd (patch)
treea6e6d4472b48a85360c0d9dd14be7b0f8d356f91 /mysql-test/main/intersect.test
parent58f3ff71751eae2d697bb45a6cefd197547e0b33 (diff)
downloadmariadb-git-6d68a3464e9a93baecc277a2c270cad28fbf50bd.tar.gz
MDEV-18701: Wrong result from query that uses INTERSECT after UNION ALL
Recalculate distinct pointer if we cut chain of SELECTs
Diffstat (limited to 'mysql-test/main/intersect.test')
-rw-r--r--mysql-test/main/intersect.test27
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/main/intersect.test b/mysql-test/main/intersect.test
index 0a68cab21f0..616a833ea3c 100644
--- a/mysql-test/main/intersect.test
+++ b/mysql-test/main/intersect.test
@@ -321,3 +321,30 @@ select * from t13 union select * from t234 intersect select * from t12;
drop table t12,t13,t234;
--echo # End of 10.3 tests
+
+--echo #
+--echo # MDEV-18701: Wrong result from query that uses INTERSECT after UNION ALL
+--echo #
+
+create table t1 (a int);
+insert into t1 values (3), (1), (7), (3), (2), (7), (4);
+create table t2 (a int);
+insert into t2 values (4), (5), (9), (1), (8), (9);
+create table t3 (a int);
+insert into t3 values (8), (1), (8), (2), (3), (7), (2);
+
+
+select * from t1 where a > 4
+union all
+select * from t2 where a < 5
+intersect
+select * from t3 where a < 5;
+
+explain extended
+select * from t1 where a > 4
+union all
+select * from t2 where a < 5
+intersect
+select * from t3 where a < 5;
+
+drop table t1,t2,t3;