summaryrefslogtreecommitdiff
path: root/mysql-test/t/parser.test
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-05-20 09:21:07 +0400
committerAlexander Barkov <bar@mariadb.org>2016-05-20 09:21:07 +0400
commitf6a7c1c75ac68dbd23c0666bf586126c2e5b3617 (patch)
tree8e598bb29c552a3c9aa8bba7806208e8f7a1f39c /mysql-test/t/parser.test
parentc9629daa1ed383d5ea90b7a8542cf2e2e7f7f842 (diff)
downloadmariadb-git-f6a7c1c75ac68dbd23c0666bf586126c2e5b3617.tar.gz
MDEV-10080 Derived tables allow double LIMIT clause
1. Moving the "| get_select_lex_derived select_derived_init" part of select_derived into a separate new rule derived_query_specification. 2. Using derived_query_specification directly in select_derived_union rather than in select_derived. 3. Moving the sequence "opt_order_clause opt_limit_clause opt_select_lock_type" from select_derived2 to select_derived_union, after derived_query_specification. Effectively, the parser now does not go through the sequence "opt_order_clause opt_limit_clause ... opt_union_order_or_limit" any more. This fixes the problem with double LIMIT clause and removes 2 shift/reduce conflicts.
Diffstat (limited to 'mysql-test/t/parser.test')
-rw-r--r--mysql-test/t/parser.test11
1 files changed, 10 insertions, 1 deletions
diff --git a/mysql-test/t/parser.test b/mysql-test/t/parser.test
index a143a61f995..ae456574c39 100644
--- a/mysql-test/t/parser.test
+++ b/mysql-test/t/parser.test
@@ -975,7 +975,7 @@ let $q=SELECT 1 FROM t1 LIMIT 1 ORDER BY 1 UNION SELECT 1 FROM t1;
eval $q;
--error ER_PARSE_ERROR
eval SELECT ($q);
---error ER_WRONG_USAGE
+--error ER_PARSE_ERROR
eval SELECT 1 FROM ($q) a;
let $q=SELECT 1 FROM t1 ORDER BY 1 UNION SELECT 1 FROM t1 ORDER BY 1;
@@ -1021,3 +1021,12 @@ SELECT *
FROM ( (SELECT a FROM t1 ORDER BY a) UNION (SELECT 1 as b ORDER BY b ) ) AS a1
WHERE a1.a = 1 OR a1.a = 2;
DROP TABLE t1;
+
+--echo #
+--echo # MDEV-10080 Derived tables allow double LIMIT clause
+--echo #
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+--error ER_PARSE_ERROR
+SELECT * FROM (SELECT * FROM t1 LIMIT 1 LIMIT 2) t1;
+DROP TABLE t1;