List:Commits« Previous MessageNext Message »
From:Dmitry Lenev Date:June 9 2011 1:16pm
Subject:bzr commit into mysql-trunk branch (Dmitry.Lenev:3173) Bug#11759990
View as plain text  
#At file:///home/dlenev/src/bzr/mysql-trunk-mrg/ based on revid:marko.makela@stripped

 3173 Dmitry Lenev	2011-06-09 [merge]
      Merged fix for bug #11759990 - "52354: 'CREATE TABLE
      .. LIKE ... ' STATEMENTS FAIL" into mysql-trunk.

    modified:
      mysql-test/r/symlink.result
      mysql-test/t/symlink.test
      sql/sql_table.cc
=== modified file 'mysql-test/r/symlink.result'
--- a/mysql-test/r/symlink.result	2011-01-31 09:34:39 +0000
+++ b/mysql-test/r/symlink.result	2011-06-09 12:54:12 +0000
@@ -188,3 +188,28 @@ DROP TABLE user;
 FLUSH TABLE mysql.user;
 SELECT * FROM mysql.user;
 End of 5.1 tests
+#
+# Test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
+#                           STATEMENTS FAIL".
+#
+drop table if exists t1, t2;
+create table t1 (a int primary key) engine=myisam
+data directory="MYSQLTEST_VARDIR/tmp"
+      index directory="MYSQLTEST_VARDIR/run";
+show create table t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1 DATA DIRECTORY='MYSQLTEST_VARDIR/tmp/' INDEX DIRECTORY='MYSQLTEST_VARDIR/run/'
+# CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
+# options should not fail. Per documentation newly created table
+# should not inherit value of these options from the original table.
+create table t2 like t1;
+show create table t2;
+Table	Create Table
+t2	CREATE TABLE `t2` (
+  `a` int(11) NOT NULL,
+  PRIMARY KEY (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop tables t1, t2;

=== modified file 'mysql-test/t/symlink.test'
--- a/mysql-test/t/symlink.test	2011-01-31 09:34:39 +0000
+++ b/mysql-test/t/symlink.test	2011-06-09 12:54:12 +0000
@@ -277,3 +277,24 @@ SELECT * FROM mysql.user;
 --remove_file $MYSQL_TMP_DIR/mysql
 
 --echo End of 5.1 tests
+
+
+--echo #
+--echo # Test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
+--echo #                           STATEMENTS FAIL".
+--echo #
+--disable_warnings
+drop table if exists t1, t2;
+--enable_warnings
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+eval create table t1 (a int primary key) engine=myisam
+      data directory="$MYSQLTEST_VARDIR/tmp"
+      index directory="$MYSQLTEST_VARDIR/run";
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+show create table t1;
+--echo # CREATE TABLE LIKE statement on table with INDEX/DATA DIRECTORY
+--echo # options should not fail. Per documentation newly created table
+--echo # should not inherit value of these options from the original table.
+create table t2 like t1;
+show create table t2;
+drop tables t1, t2;

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2011-06-09 08:58:41 +0000
+++ b/sql/sql_table.cc	2011-06-09 13:15:29 +0000
@@ -4786,6 +4786,11 @@ bool mysql_create_like_table(THD* thd, T
   local_create_info.options|= create_info->options & HA_LEX_CREATE_TMP_TABLE;
   /* Reset auto-increment counter for the new table. */
   local_create_info.auto_increment_value= 0;
+  /*
+    Do not inherit values of DATA and INDEX DIRECTORY options from
+    the original table. This is documented behavior.
+  */
+  local_create_info.data_file_name= local_create_info.index_file_name= NULL;
 
   if ((res= mysql_create_table_no_lock(thd, table->db, table->table_name,
                                        &local_create_info, &local_alter_info,

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-trunk branch (Dmitry.Lenev:3173) Bug#11759990Dmitry Lenev9 Jun