List:Commits« Previous MessageNext Message »
From:eugene Date:March 21 2007 7:54pm
Subject:bk commit into 5.0 tree (evgen:1.2487) BUG#23345
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of evgen. When evgen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-03-21 21:54:38+03:00, evgen@stripped +3 -0
  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/r/union.result@stripped, 2007-03-21 21:53:53+03:00, evgen@stripped +8 -0
    Added a test case for the bug#23345: Wrongly allowed INTO in a non-last select of a
UNION.

  mysql-test/t/union.test@stripped, 2007-03-21 21:53:51+03:00, evgen@stripped +9 -0
    Added a test case for the bug#23345: Wrongly allowed INTO in a non-last select of a
UNION.

  sql/sql_yacc.yy@stripped, 2007-03-21 21:53:53+03:00, evgen@stripped +1 -1
    Bug#23345: Wrongly allowed INTO in a non-last select of a UNION.
    Now INTO allowed only in the last select of a UNION.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	evgen
# Host:	moonbone.local
# Root:	/mnt/gentoo64/work/23345-bug-5.0-opt-mysql

--- 1.510/sql/sql_yacc.yy	2007-03-09 17:25:24 +03:00
+++ 1.511/sql/sql_yacc.yy	2007-03-21 21:53:53 +03:00
@@ -9307,7 +9307,7 @@
 	UNION_SYM union_option
 	{
 	  LEX *lex=Lex;
-	  if (lex->exchange)
+	  if (lex->result)
 	  {
 	    /* Only the last SELECT can have  INTO...... */
 	    my_error(ER_WRONG_USAGE, MYF(0), "UNION", "INTO");

--- 1.89/mysql-test/r/union.result	2007-03-10 19:50:55 +03:00
+++ 1.90/mysql-test/r/union.result	2007-03-21 21:53:53 +03:00
@@ -1381,4 +1381,12 @@
 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'
 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

--- 1.98/mysql-test/t/union.test	2007-03-09 12:45:30 +03:00
+++ 1.99/mysql-test/t/union.test	2007-03-21 21:53:51 +03:00
@@ -868,4 +868,13 @@
 
 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
Thread
bk commit into 5.0 tree (evgen:1.2487) BUG#23345eugene21 Mar