List:Internals« Previous MessageNext Message »
From:antony Date:June 5 2005 7:24pm
Subject:bk commit into 4.1 tree (acurtis:1.2314) BUG#11028
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of antony. When antony 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.2314 05/06/05 18:24:44 acurtis@stripped +3 -0
  Bug#11028 Crash on create table like
    Report error instead of crashing

  sql/sql_table.cc
    1.288 05/06/05 18:24:28 acurtis@stripped +11 -5
    fix for null db name

  mysql-test/t/create.test
    1.54 05/06/05 18:24:28 acurtis@stripped +7 -0
    Test for bug 11028

  mysql-test/r/create.result
    1.82 05/06/05 18:24:28 acurtis@stripped +2 -0
    Test for bug 11028

# 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:	acurtis
# Host:	ltantony
# Root:	/usr/home/antony/work2/p1-bug11028.1

--- 1.287/sql/sql_table.cc	2005-06-04 06:23:31 +01:00
+++ 1.288/sql/sql_table.cc	2005-06-05 18:24:28 +01:00
@@ -2298,26 +2298,32 @@
   char src_path[FN_REFLEN], dst_path[FN_REFLEN];
   char *db= table->db;
   char *table_name= table->real_name;
-  char *src_db= thd->db;
+  char *src_db;
   char *src_table= table_ident->table.str;
   int  err, res= -1;
   TABLE_LIST src_tables_list;
   DBUG_ENTER("mysql_create_like_table");
+  src_db= (table_ident->db.str && table_ident->db.str[0]) ?
+        table_ident->db.str : thd->db;
 
   /*
     Validate the source table
   */
   if (table_ident->table.length > NAME_LEN ||
       (table_ident->table.length &&
-       check_table_name(src_table,table_ident->table.length)) ||
-      table_ident->db.str && check_db_name((src_db= table_ident->db.str)))
+       check_table_name(src_table,table_ident->table.length)))
   {
     my_error(ER_WRONG_TABLE_NAME, MYF(0), src_table);
     DBUG_RETURN(-1);
   }
+  if (!src_db || check_db_name(src_db))
+  {
+    my_error(ER_WRONG_DB_NAME, MYF(0), src_db ? src_db : "NULL");
+    DBUG_RETURN(-1);
+  }
 
-  src_tables_list.db= table_ident->db.str ? table_ident->db.str : thd->db;
-  src_tables_list.real_name= table_ident->table.str;
+  src_tables_list.db= src_db;
+  src_tables_list.real_name= src_table;
   src_tables_list.next= 0;
 
   if (lock_and_wait_for_table_name(thd, &src_tables_list))

--- 1.81/mysql-test/r/create.result	2005-06-04 06:15:04 +01:00
+++ 1.82/mysql-test/r/create.result	2005-06-05 18:24:28 +01:00
@@ -580,3 +580,5 @@
 create table t1(t1.name int);
 create table t2(test.t2.name int);
 drop table t1,t2;
+ERROR 1102 (42000) at line 1: Incorrect database name 'NULL'
+drop table if exists t1;

--- 1.53/mysql-test/t/create.test	2005-06-04 06:15:04 +01:00
+++ 1.54/mysql-test/t/create.test	2005-06-05 18:24:28 +01:00
@@ -492,3 +492,10 @@
 create table t2(test.t2.name int);
 drop table t1,t2;
 
+#
+# Bug#11028: Crash on create table like
+#
+--exec echo "create table test.t1 like x" | $MYSQL 2>&1 || true
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
Thread
bk commit into 4.1 tree (acurtis:1.2314) BUG#11028antony5 Jun