List:Commits« Previous MessageNext Message »
From:kpettersson Date:September 19 2006 9:00am
Subject:bk commit into 5.1 tree (thek:1.2356)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of thek. When thek 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, 2006-09-19 11:00:08+02:00, thek@stripped +4 -0
  Merge kpdesk.mysql.com:/home/thek/dev/bug21139/my50-bug21139
  into  kpdesk.mysql.com:/home/thek/dev/mysql-5.1-new-maint
  MERGE: 1.1810.2066.2

  mysql-test/r/insert_select.result@stripped, 2006-09-19 11:00:03+02:00, thek@stripped +0 -0
    Auto merged
    MERGE: 1.35.1.6

  sql/sql_base.cc@stripped, 2006-09-19 11:00:03+02:00, thek@stripped +0 -0
    Auto merged
    MERGE: 1.235.66.1

  sql/sql_insert.cc@stripped, 2006-09-19 11:00:04+02:00, thek@stripped +0 -0
    Auto merged
    MERGE: 1.146.1.54

  sql/sql_parse.cc@stripped, 2006-09-19 11:00:04+02:00, thek@stripped +0 -0
    Auto merged
    MERGE: 1.426.104.1

# 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:	thek
# Host:	kpdesk.mysql.com
# Root:	/home/thek/dev/mysql-5.1-new-maint/RESYNC

--- 1.350/sql/sql_base.cc	2006-09-19 11:00:14 +02:00
+++ 1.351/sql/sql_base.cc	2006-09-19 11:00:14 +02:00
@@ -5371,7 +5371,20 @@
   uint tablenr= 0;
   DBUG_ENTER("setup_tables");
 
-  context->table_list= context->first_name_resolution_table= tables;
+  /*
+    Due to the various call paths that lead to setup_tables() it may happen
+    that context->table_list and context->first_name_resolution_table can be
+    NULL (this is typically done when creating TABLE_LISTs internally).
+    TODO:
+    Investigate all cases when this my happen, initialize the name resolution
+    context correctly in all those places, and remove the context reset below.
+  */
+  if (!context->table_list || !context->first_name_resolution_table)
+  {
+    /* Test whether the context is in a consistent state. */
+    DBUG_ASSERT(!context->first_name_resolution_table && !context->table_list);
+    context->table_list= context->first_name_resolution_table= tables;
+  }
 
   /*
     this is used for INSERT ... SELECT.

--- 1.222/sql/sql_insert.cc	2006-09-19 11:00:14 +02:00
+++ 1.223/sql/sql_insert.cc	2006-09-19 11:00:14 +02:00
@@ -395,6 +395,15 @@
   table= table_list->table;
 
   context= &thd->lex->select_lex.context;
+  /*
+    These three asserts test the hypothesis that the resetting of the name
+    resolution context below is not necessary at all since the list of local
+    tables for INSERT always consists of one table.
+  */
+  DBUG_ASSERT(!table_list->next_local);
+  DBUG_ASSERT(!context->table_list->next_local);
+  DBUG_ASSERT(!context->first_name_resolution_table->next_name_resolution_table);
+
   /* Save the state of the current name resolution context. */
   ctx_state.save_state(context, table_list);
 

--- 1.586/sql/sql_parse.cc	2006-09-19 11:00:14 +02:00
+++ 1.587/sql/sql_parse.cc	2006-09-19 11:00:14 +02:00
@@ -3383,8 +3383,6 @@
     DBUG_ASSERT(first_table == all_tables && first_table != 0);
     if ((res= insert_precheck(thd, all_tables)))
       break;
-    /* Skip first table, which is the table we are inserting in */
-    select_lex->context.table_list= first_table->next_local;
 
     if (!thd->locked_tables &&
         !(need_start_waiting= !wait_if_global_read_lock(thd, 0, 1)))

--- 1.42/mysql-test/r/insert_select.result	2006-09-19 11:00:14 +02:00
+++ 1.43/mysql-test/r/insert_select.result	2006-09-19 11:00:14 +02:00
@@ -695,6 +695,16 @@
 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;
+CREATE DATABASE bug21774_1;
+CREATE DATABASE bug21774_2;
+CREATE TABLE bug21774_1.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
+CREATE TABLE bug21774_2.t1(id VARCHAR(10) NOT NULL,label VARCHAR(255));
+CREATE TABLE bug21774_1.t2(id VARCHAR(10) NOT NULL,label VARCHAR(255));
+INSERT INTO bug21774_2.t1 SELECT t1.* FROM bug21774_1.t1;
+use bug21774_1;
+INSERT INTO bug21774_2.t1 SELECT t1.* FROM t1;
+DROP DATABASE bug21774_1;
+DROP DATABASE bug21774_2;
 CREATE DATABASE meow;
 CREATE TABLE table_target   ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
 CREATE TABLE table_target2  ( mexs_id CHAR(8), messzeit TIMESTAMP, PRIMARY KEY (mexs_id));
Thread
bk commit into 5.1 tree (thek:1.2356)kpettersson19 Sep