Bug #1317 CREATE TABLE LIKE ignores DATA/INDEX DIRECTPORY
Submitted: 17 Sep 2003 1:39 Modified: 25 Oct 2003 7:59
Reporter: Georg Richter Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.1.1 OS:
Assigned to: Bugs System CPU Architecture:Any

[17 Sep 2003 1:39] Georg Richter
Description:
CREATE TABLE x LIKE y ignores the directory attributes from table y.

How to repeat:
mysql> create table a (a int) max_rows=10 DATA DIRECTORY='/data/tmp';
Query OK, 0 rows affected (0.00 sec)

mysql> create table b like a;
Query OK, 0 rows affected (0.00 sec)

mysql> show create table a;
+-------+-----------------------------------------------------------------------
---------------------------------------------+
| Table | Create Table
                                             |
+-------+-----------------------------------------------------------------------
---------------------------------------------+
| a     | CREATE TABLE `a` (
  `a` int(11) default NULL
) TYPE=MyISAM CHARSET=latin1 MAX_ROWS=10 DATA DIRECTORY='/data/tmp/' |
+-------+-----------------------------------------------------------------------                                             ---------------------------------------------+
1 row in set (0.00 sec)

mysql> show create table b;
+-------+-----------------------------------------------------------------------                                             -----------------+
| Table | Create Table                                                                                                                        |
+-------+-----------------------------------------------------------------------                                             -----------------+
| b     | CREATE TABLE `b` (
  `a` int(11) default NULL
) TYPE=MyISAM CHARSET=latin1 MAX_ROWS=10 |
+-------+-----------------------------------------------------------------------                                             -----------------+
1 row in set (0.00 sec)

mysql>

georg@vivaldi:~> ls /data/tmp
a.MYD
[18 Sep 2003 5:24] Alexander Keremidarski
In 4.1 compiled from 
ChangeSet@1.1579.1.1, 2003-09-16 02:58:46+04:00, dlenev@dlenev.mshome

even SHOW CREATE TABLE a; does not report DATADIR at all while .MYD file is placed at specified DATADIR location

create table a (a int) max_rows=10 DATA DIRECTORY='/tmp';
create table b like a;
show create table a;

+-------+--------------------------------------------------------------------------------------+
| Table | Create Table                |
+-------+--------------------------------------------------------------------------------------+
| a     | CREATE TABLE `a` (
  `a` int(11) default NULL
) TYPE=MyISAM CHARSET=utf8 MAX_ROWS=10 |
+-------+--------------------------------------------------------------------------------------+

# ls /tmp/*.MYD
/tmp/a.MYD
[18 Sep 2003 5:52] Georg Richter
Salle, sorry the output was from an older version. I filed this bug a few weeks before and forgot 
to submit it. 
 
CREATE TABLE contains now DATA DIRECTORY in actual bk-version. 
 
mysql> create table a (a int) DATA DIRECTORY ='/data/tmp'; 
Query OK, 0 rows affected (0.06 sec) 
 
mysql> show create table a; 
+-------+--------------------------------------------------------------------------------------------------------+ 
| Table | Create Table                                                                                           | 
+-------+--------------------------------------------------------------------------------------------------------+ 
| a     | CREATE TABLE `a` ( 
  `a` int(11) default NULL 
) TYPE=MyISAM CHARSET=latin1 DATA DIRECTORY='/data/tmp/' | 
+-------+--------------------------------------------------------------------------------------------------------+ 
1 row in set (0.00 sec) 
 
mysql> create table b like a; 
Query OK, 0 rows affected (0.06 sec) 
 
mysql> show create table b; 
+-------+----------------------------------------------------------------------------+ 
| Table | Create Table                                                               | 
+-------+----------------------------------------------------------------------------+ 
| b     | CREATE TABLE `b` ( 
  `a` int(11) default NULL 
) TYPE=MyISAM CHARSET=latin1 | 
+-------+----------------------------------------------------------------------------+ 
1 row in set (0.01 sec)
[25 Oct 2003 7:59] Victor Vagin
Thank you for your bug report. This issue has been addressed in the
documentation. The updated documentation will appear on our website
shortly, and will be included in the next release of the relevant
product(s).

http://www.mysql.com/doc/en/CREATE_TABLE.html

[CREATE TABLE ... LIKE does not copy any DATA DIRECTORY or INDEX DIRECTORY table options that were specified for the original table. ]