Commit 52e904c2 authored by timour@mysql.com's avatar timour@mysql.com

Fix for BUG#8023.

Allow LIMIT clause after DUAL.
parent b018755e
...@@ -67,3 +67,12 @@ SELECT * FROM t1; ...@@ -67,3 +67,12 @@ SELECT * FROM t1;
id id2 id id2
3 0 3 0
DROP TABLE t1; DROP TABLE t1;
create table t1 (a integer);
insert into t1 values (1);
select 1 as a from t1 union all select 1 from dual limit 1;
a
1
(select 1 as a from t1) union all (select 1 from dual) limit 1;
a
1
drop table t1;
...@@ -49,3 +49,13 @@ SELECT * FROM t1; ...@@ -49,3 +49,13 @@ SELECT * FROM t1;
DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1; DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
SELECT * FROM t1; SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
#
# Bug#8023 - limit on UNION with from DUAL, causes syntax error
#
create table t1 (a integer);
insert into t1 values (1);
# both queries must return one row
select 1 as a from t1 union all select 1 from dual limit 1;
(select 1 as a from t1) union all (select 1 from dual) limit 1;
drop table t1;
...@@ -2455,10 +2455,11 @@ select_into: ...@@ -2455,10 +2455,11 @@ select_into:
select_from: select_from:
FROM join_table_list where_clause group_clause having_clause FROM join_table_list where_clause group_clause having_clause
opt_order_clause opt_limit_clause procedure_clause opt_order_clause opt_limit_clause procedure_clause
| FROM DUAL_SYM /* oracle compatibility: oracle always requires FROM | FROM DUAL_SYM opt_limit_clause
clause, and DUAL is system table without fields. /* oracle compatibility: oracle always requires FROM clause,
Is "SELECT 1 FROM DUAL" any better than and DUAL is system table without fields.
"SELECT 1" ? Hmmm :) */ Is "SELECT 1 FROM DUAL" any better than "SELECT 1" ?
Hmmm :) */
; ;
select_options: select_options:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment