List:Commits« Previous MessageNext Message »
From:kgeorge Date:June 19 2006 4:34pm
Subject:bk commit into 5.0 tree (gkodinov:1.2184) BUG#18080
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kgeorge. When kgeorge 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
  1.2184 06/06/19 17:34:12 gkodinov@stripped +3 -0
  Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
  
  There was an incomplete reset of the name resolution context, that caused 
  INSERT ... SELECT ... JOIN statements to resolve not by joint row type calculated
  for the join.
  Removed the redundant re-initialization of the context, because 
  mysql_insert_select_prepare() now correctly saves/restores the context.

  sql/sql_parse.cc
    1.551 06/06/19 17:34:06 gkodinov@stripped +0 -9
    Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
    
    - remove an incomplete reset of the context because the mentioned function
    correctly saves/restores the context.

  mysql-test/t/insert_select.test
    1.29 06/06/19 17:34:06 gkodinov@stripped +9 -0
    Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
    
    - testsuite for the bug

  mysql-test/r/insert_select.result
    1.36 06/06/19 17:34:06 gkodinov@stripped +5 -0
    Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
    
    - testsuite for the bug

# 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:	gkodinov
# Host:	rakia.(none)
# Root:	/home/kgeorge/mysql/5.0/B18080

--- 1.550/sql/sql_parse.cc	2006-06-16 23:49:13 +03:00
+++ 1.551/sql/sql_parse.cc	2006-06-19 17:34:06 +03:00
@@ -3333,15 +3333,6 @@
                                              &lex->value_list,
                                              lex->duplicates, lex->ignore)))
       {
-        /*
-          Skip first table, which is the table we are inserting in.
-          Below we set context.table_list again because the call above to
-          mysql_insert_select_prepare() calls resolve_in_table_list_only(),
-          which in turn resets context.table_list and
-          context.first_name_resolution_table.
-        */
-        select_lex->context.table_list= 
-          select_lex->context.first_name_resolution_table= second_table;
 	res= handle_select(thd, lex, result, OPTION_SETUP_TABLES_DONE);
         /*
           Invalidate the table in the query cache if something changed

--- 1.35/mysql-test/r/insert_select.result	2005-10-28 02:35:57 +03:00
+++ 1.36/mysql-test/r/insert_select.result	2006-06-19 17:34:06 +03:00
@@ -686,3 +686,8 @@
 insert into t1(x,y) select x,z from t2 on duplicate key update x=values(t2.x);
 ERROR 42S22: Unknown column 't2.x' in 'field list'
 drop table t1,t2;
+CREATE TABLE t1 (x int, y int);
+CREATE TABLE t2 (z int, y int);
+CREATE TABLE t3 (a int, b int);
+INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
+DROP TABLE IF EXISTS t1,t2,t3;

--- 1.28/mysql-test/t/insert_select.test	2005-10-28 02:35:58 +03:00
+++ 1.29/mysql-test/t/insert_select.test	2006-06-19 17:34:06 +03:00
@@ -225,3 +225,12 @@
 drop table t1,t2; 
 
 # End of 4.1 tests
+
+#
+# Bug #18080: INSERT ... SELECT ... JOIN results in ambiguous field list error
+#
+CREATE TABLE t1 (x int, y int);
+CREATE TABLE t2 (z int, y int);
+CREATE TABLE t3 (a int, b int);
+INSERT INTO t3 (SELECT x, y FROM t1 JOIN t2 USING (y) WHERE z = 1);
+DROP TABLE IF EXISTS t1,t2,t3;
Thread
bk commit into 5.0 tree (gkodinov:1.2184) BUG#18080kgeorge19 Jun