summaryrefslogtreecommitdiff
path: root/mysql-test/t/union.test
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2007-03-21 21:54:38 +0300
committerunknown <evgen@moonbone.local>2007-03-21 21:54:38 +0300
commit16404523645b8f396ebaea9da5dfa4c453056d06 (patch)
tree4f651eaf4e0ed6433b9456ee1dcc1314f5430be4 /mysql-test/t/union.test
parent3798a7d5008f8f569f779f096b7fc1e1cfac1031 (diff)
downloadmariadb-git-16404523645b8f396ebaea9da5dfa4c453056d06.tar.gz
Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
INTO clause can be specified only for the last select of a UNION and it receives the result of the whole query. But it was wrongly allowed in non-last selects of a UNION which leads to a confusing query result. Now INTO allowed only in the last select of a UNION. mysql-test/t/union.test: Added a test case for the bug#23345: Wrongly allowed INTO in a non-last select of a UNION. mysql-test/r/union.result: Added a test case for the bug#23345: Wrongly allowed INTO in a non-last select of a UNION. sql/sql_yacc.yy: Bug#23345: Wrongly allowed INTO in a non-last select of a UNION. Now INTO allowed only in the last select of a UNION.
Diffstat (limited to 'mysql-test/t/union.test')
-rw-r--r--mysql-test/t/union.test9
1 files changed, 9 insertions, 0 deletions
diff --git a/mysql-test/t/union.test b/mysql-test/t/union.test
index 29a9ee36481..22f09466b1c 100644
--- a/mysql-test/t/union.test
+++ b/mysql-test/t/union.test
@@ -868,4 +868,13 @@ SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
DROP TABLE t1;
+#
+# Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
+#
+--error 1221
+(select 1 into @var) union (select 1);
+(select 1) union (select 1 into @var);
+select @var;
+--error 1172
+(select 2) union (select 1 into @var);
--echo End of 5.0 tests