summaryrefslogtreecommitdiff
path: root/mysql-test/main/union.test
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2019-02-22 21:38:55 -0800
committerIgor Babaev <igor@askmonty.org>2019-02-22 21:38:55 -0800
commit09bd2138522787a4e0b015695c462903f4a9e728 (patch)
tree502f97b2ecf3b2ca27e448faeab11a2b71602697 /mysql-test/main/union.test
parent4946eb7b54323f98fa2e399e981467733c3b0914 (diff)
downloadmariadb-git-09bd2138522787a4e0b015695c462903f4a9e728.tar.gz
MDEV-18700 EXPLAIN EXTENDED shows a wrong operation for query
with UNION ALL after INTERSECT EXPLAIN EXTENDED erroneously showed UNION instead of UNION ALL in the warning if UNION ALL followed INTERSECT or EXCEPT operations. The bug was in the function st_select_lex_unit::print() that printed the text of the query used in the warning.
Diffstat (limited to 'mysql-test/main/union.test')
-rw-r--r--mysql-test/main/union.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test
index e7543ba4a81..9d9194ebab6 100644
--- a/mysql-test/main/union.test
+++ b/mysql-test/main/union.test
@@ -1812,5 +1812,35 @@ SELECT c1 FROM t1 UNION SELECT - @a FROM t2;
drop table t1,t2;
--echo #
+--echo # MDEV-18700: EXPLAIN EXTENDED for query with UNION ALL
+--echo # after INTERSECT/EXCEPT operations
+--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);
+
+explain extended
+select * from t2 where a < 5
+intersect
+select * from t3 where a < 5
+union all
+select * from t1 where a > 4;
+
+explain extended
+select * from t2 where a < 5
+except
+select * from t3 where a < 5
+union all
+select * from t1 where a > 4;
+
+drop table t1,t2,t3;
+
+--echo #
--echo # End of 10.3 tests
--echo #