Commit b70693f5 authored by unknown's avatar unknown

Merge epotemkin@bk-internal.mysql.com:/home/bk/mysql-5.0-opt

into  moonbone.local:/mnt/gentoo64/work/23345-bug-5.0-opt-mysql

parents 2fd63201 16404523
...@@ -1381,4 +1381,12 @@ a ...@@ -1381,4 +1381,12 @@ a
SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test; SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
ERROR 42S22: Unknown column 'c' in 'order clause' ERROR 42S22: Unknown column 'c' in 'order clause'
DROP TABLE t1; DROP TABLE t1;
(select 1 into @var) union (select 1);
ERROR HY000: Incorrect usage of UNION and INTO
(select 1) union (select 1 into @var);
select @var;
@var
1
(select 2) union (select 1 into @var);
ERROR 42000: Result consisted of more than one row
End of 5.0 tests End of 5.0 tests
...@@ -868,4 +868,13 @@ SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS 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; 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 --echo End of 5.0 tests
...@@ -9307,7 +9307,7 @@ union_list: ...@@ -9307,7 +9307,7 @@ union_list:
UNION_SYM union_option UNION_SYM union_option
{ {
LEX *lex=Lex; LEX *lex=Lex;
if (lex->exchange) if (lex->result)
{ {
/* Only the last SELECT can have INTO...... */ /* Only the last SELECT can have INTO...... */
my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO"); my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");
......
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