List:Commits« Previous MessageNext Message »
From:holyfoot Date:March 9 2007 12:51pm
Subject:bk commit into 5.1 tree (holyfoot:1.2475)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of hf. When hf 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-09 16:51:32+04:00, holyfoot@hfmain.(none) +3 -0
  Merge mysql.com:/home/hf/work/mrg/mysql-5.0-opt
  into  mysql.com:/home/hf/work/mrg/mysql-5.1-opt
  MERGE: 1.1810.2373.147

  mysql-test/r/union.result@stripped, 2007-03-09 16:51:29+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.80.1.8

  mysql-test/t/union.test@stripped, 2007-03-09 16:51:29+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.97.1.1

  sql/item.cc@stripped, 2007-03-09 16:51:29+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.113.1.141

# 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:	holyfoot
# Host:	hfmain.(none)
# Root:	/home/hf/work/mrg/mysql-5.1-opt/RESYNC

--- 1.250/sql/item.cc	2007-03-09 16:51:38 +04:00
+++ 1.251/sql/item.cc	2007-03-09 16:51:38 +04:00
@@ -3475,7 +3475,12 @@ Item_field::fix_outer_field(THD *thd, Fi
   */
   Name_resolution_context *last_checked_context= context;
   Item **ref= (Item **) not_found_item;
-  Name_resolution_context *outer_context= context->outer_context;
+  SELECT_LEX *current_sel= (SELECT_LEX *) thd->lex->current_select;
+  Name_resolution_context *outer_context= 0;
+  /* Currently derived tables cannot be correlated */
+  if (current_sel->master_unit()->first_select()->linkage !=
+      DERIVED_TABLE_TYPE)
+    outer_context= context->outer_context;
   for (;
        outer_context;
        outer_context= outer_context->outer_context)

--- 1.93/mysql-test/r/union.result	2007-03-09 16:51:38 +04:00
+++ 1.94/mysql-test/r/union.result	2007-03-09 16:51:38 +04:00
@@ -1426,4 +1426,15 @@ select _utf8'12' union select _latin1'12
 12
 12
 12345
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3),(1),(2),(4),(1);
+SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a) AS test;
+a
+1
+2
+3
+4
+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;
 End of 5.0 tests

--- 1.99/mysql-test/t/union.test	2007-03-09 16:51:38 +04:00
+++ 1.100/mysql-test/t/union.test	2007-03-09 16:51:38 +04:00
@@ -900,4 +900,17 @@ drop table t1, t2;
 #
 select _utf8'12' union select _latin1'12345';
 
+#
+# Bug #26661: UNION with ORDER BY undefined column in FROM list
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (3),(1),(2),(4),(1);
+
+SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY a) AS test;
+--error 1054 
+SELECT a FROM (SELECT a FROM t1 UNION SELECT a FROM t1 ORDER BY c) AS test;
+
+DROP TABLE t1;
+
 --echo End of 5.0 tests
Thread
bk commit into 5.1 tree (holyfoot:1.2475)holyfoot9 Mar