1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-16357 LIMIT and ORDER BY clause is ignored on a query with UNION

when using brackets

Do not create master unit for select if it has already one.
This commit is contained in:
Igor Babaev
2018-11-06 09:40:07 -08:00
parent 074c684099
commit 41e68e8e5b
3 changed files with 45 additions and 0 deletions

View File

@ -88,5 +88,23 @@ select 1 union select 1 union select 1;
(select 1 union select 1 union select 1);
((select 1) union (select 1) union (select 1));
--echo #
--echo # MDEV-16357: union in brackets with tail
--echo # union with tail in brackets
--echo #
CREATE TABLE t1 (a int);
INSERT INTO t1 VALUES(1),(2),(3),(4);
CREATE TABLE t2 (a int);
INSERT INTO t2 VALUES (4),(5),(6),(7);
(SELECT a FROM t1 UNION SELECT a FROM t2) LIMIT 1;
(SELECT a FROM t1 UNION SELECT a FROM t2) ORDER BY a DESC;
(SELECT a FROM t1 UNION SELECT a FROM t2 LIMIT 1);
DROP TABLE t1,t2;
--echo # End of 10.4 tests