summaryrefslogtreecommitdiff
path: root/sql/sql_table.cc
diff options
context:
space:
mode:
authorDmitry Lenev <Dmitry.Lenev@oracle.com>2011-06-09 16:54:12 +0400
committerDmitry Lenev <Dmitry.Lenev@oracle.com>2011-06-09 16:54:12 +0400
commit600647c7d8647dc31025146896a671619d73d97f (patch)
treeed0d4c5d18718a81385afad3ba485cb28f02c165 /sql/sql_table.cc
parent34baff7743df3f6fb67c8e4bffa58e9758b0c86b (diff)
downloadmariadb-git-600647c7d8647dc31025146896a671619d73d97f.tar.gz
Fix for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... '
STATEMENTS FAIL". Attempt to execute CREATE TABLE LIKE statement on a MyISAM table with INDEX or DATA DIRECTORY options specified as a source resulted in "MyISAM table '...' is in use..." error. According to our documentation such a statement should create a copy of source table with DATA/INDEX DIRECTORY options omitted. The problem was that new implementation of CREATE TABLE LIKE statement in 5.5 tried to copy value of INDEX and DATA DIRECTORY parameters from the source table. Since in description of source table this parameters also included name of this table, attempt to create target table with these parameter led to file name conflict and error. This fix addresses the problem by preserving documented and backward-compatible behavior. I.e. by ensuring that contents of DATA/INDEX DIRECTORY clauses for the source table is ignored when target table is created. mysql-test/r/symlink.result: Added test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... ' STATEMENTS FAIL". mysql-test/t/symlink.test: Added test for bug #11759990 - "52354: 'CREATE TABLE .. LIKE ... ' STATEMENTS FAIL". sql/sql_table.cc: Changed CREATE TABLE LIKE implementation to ignore contents of DATA/INDEX DIRECTORY clauses for source table when target table is created. This is documented and backward-compatible behavior.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r--sql/sql_table.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index a5cc386d740..7576ad3b7b3 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4582,6 +4582,11 @@ bool mysql_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table,
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,