summaryrefslogtreecommitdiff
path: root/mysql-test/t/limit.test
diff options
context:
space:
mode:
authorunknown <timour@mysql.com>2005-02-02 08:38:24 +0200
committerunknown <timour@mysql.com>2005-02-02 08:38:24 +0200
commitd81a0bede23ca74222252b6f43bd85ead5d7be2a (patch)
treee918a393d7772ab0a299bcc3ea1b6a8756f5ae7f /mysql-test/t/limit.test
parent514b2364b4156e23fb15f4506a50877011b9c7ef (diff)
downloadmariadb-git-d81a0bede23ca74222252b6f43bd85ead5d7be2a.tar.gz
Fix for BUG#8023.
Allow LIMIT clause after DUAL. mysql-test/r/limit.result: Added test result for BUG#8023. mysql-test/t/limit.test: Added test for BUG#8023. sql/sql_yacc.yy: Allow the specification of a LIMIT clause after DUAL. This is needed for queries as: select a from t1 union all select 1 from dual limit 1; In this query LIMIT is applied to the whole UNION, so it makes sense, however, the current parser did not allow any clause after DUAL.
Diffstat (limited to 'mysql-test/t/limit.test')
-rw-r--r--mysql-test/t/limit.test10
1 files changed, 10 insertions, 0 deletions
diff --git a/mysql-test/t/limit.test b/mysql-test/t/limit.test
index 61c57c9b468..28b287a5d4a 100644
--- a/mysql-test/t/limit.test
+++ b/mysql-test/t/limit.test
@@ -49,3 +49,13 @@ SELECT * FROM t1;
DELETE FROM t1 WHERE id2 = 0 ORDER BY id desc LIMIT 1;
SELECT * FROM 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;