From 72bf9b4847349354a269f4341349b36beb38f7fe Mon Sep 17 00:00:00 2001 From: "evgen@moonbone.local" <> Date: Wed, 21 Mar 2007 21:54:38 +0300 Subject: 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 | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'mysql-test/t/union.test') 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 -- cgit v1.2.1