1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +03:00

MDEV-25484 Crash when parsing query using derived table containing TVC

This patch fixes parsing problems concerning derived tables that use table
value constructors (TVC) with LIMIT and ORDER BY clauses of the form
  ((VALUES ... LIMIT ...) ORDER BY ...) as dt
The fix has to be applied only to 10.3 as 10.4 that employs a different
grammar rules has no such problems. The test cases should be merged
upstream.

Approved by Oleksandr Byelkin <sanja@mariadb.com>
This commit is contained in:
Igor Babaev
2021-07-23 06:42:50 -07:00
parent 73d32cc100
commit 9fde2bbacf
4 changed files with 76 additions and 5 deletions

View File

@ -1628,4 +1628,26 @@ select * from t1;
drop table t1;
--echo #
--echo # MDEV-25484: Derived table using TVC with LIMIT and ORDER BY
--echo #
create table t1 (a int);
insert into t1 values (3), (7), (1);
select * from ( (select * from t1 limit 2) order by 1 desc) as dt;
(values (3), (7), (1) limit 2) order by 1 desc;
select * from ( (values (3), (7), (1) limit 2) order by 1 desc) as dt;
select * from ( select * from t1 order by 1 limit 2 ) as dt;
values (3),(7),(1) order by 1 limit 2;
select * from ( values (3),(7),(1) order by 1 limit 2 ) as dt;
values (3),(7),(1) union values (2),(4) order by 1 limit 2;
select * from (values (3),(7),(1) union values (2),(4) order by 1 limit 2) as dt;
drop table t1;
--echo End of 10.3 tests