1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Fixed bug mdev-5410.

The fix for bug #27937 was incomplete: it did not handle correctly the queries
containing UNION with global ORDER BY in subselects.
This commit is contained in:
Igor Babaev
2013-12-12 13:55:33 -08:00
parent fde2777b27
commit 3ec4296ec4
4 changed files with 59 additions and 5 deletions

View File

@ -3284,4 +3284,27 @@ Handler_read_rnd_deleted 0
Handler_read_rnd_next 0
deallocate prepare st;
drop table t1;
#
# Bug mdev-5410: crash at the execution of PS with subselect
# formed by UNION with global ORDER BY
#
CREATE TABLE t1 (a int DEFAULT NULL);
INSERT INTO t1 VALUES (2), (4);
CREATE TABLE t2 (b int DEFAULT NULL);
INSERT INTO t2 VALUES (1), (3);
PREPARE stmt FROM "
SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b
UNION ALL
SELECT a FROM t1 WHERE t1.a+3<= t2.b
ORDER BY a DESC) AS c1 FROM t2) t3;
";
EXECUTE stmt;
c1
NULL
2
EXECUTE stmt;
c1
NULL
2
DROP TABLE t1,t2;
# End of 5.3 tests

View File

@ -3308,4 +3308,26 @@ show status like '%Handler_read%';
deallocate prepare st;
drop table t1;
--echo #
--echo # Bug mdev-5410: crash at the execution of PS with subselect
--echo # formed by UNION with global ORDER BY
--echo #
CREATE TABLE t1 (a int DEFAULT NULL);
INSERT INTO t1 VALUES (2), (4);
CREATE TABLE t2 (b int DEFAULT NULL);
INSERT INTO t2 VALUES (1), (3);
PREPARE stmt FROM "
SELECT c1 FROM (SELECT (SELECT a FROM t1 WHERE t1.a <= t2.b
UNION ALL
SELECT a FROM t1 WHERE t1.a+3<= t2.b
ORDER BY a DESC) AS c1 FROM t2) t3;
";
EXECUTE stmt;
EXECUTE stmt;
DROP TABLE t1,t2;
--echo # End of 5.3 tests