| Bug #27806 | table comments not passed in to storage engine during "CREATE ... LIKE ..." | ||
|---|---|---|---|
| Submitted: | 13 Apr 2007 11:17 | Modified: | 9 Aug 2007 13:26 |
| Reporter: | Yoshinori Matsunobu | Email Updates: | |
| Status: | Closed | ||
| Category: | Server: General | Severity: | S3 (Non-critical) |
| Version: | 5.1.17 | OS: | Any |
| Assigned to: | Konstantin Osipov | Target Version: | |
| Tags: | HA_CREATE_INFO, Storage Engine API | ||
[13 Apr 2007 11:26]
Valeriy Kravchuk
Thank you for a problem report. Sorry, but I can not repeat the behaviour described with
latest 5.1.18-BK on Linux:
openxs@suse:~/dbs/5.1> bin/mysql -uroot test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.18-beta Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> drop table t1;
Query OK, 0 rows affected (0.01 sec)
mysql> drop table t2;
Query OK, 0 rows affected (0.01 sec)
mysql> create table test.t1 (a int primary key comment "aaa") max_rows=1000
comment "bbb";
Query OK, 0 rows affected (0.01 sec)
mysql> create table test.t2 like test.t1;
Query OK, 0 rows affected (0.00 sec)
mysql> show create table t2\G
*************************** 1. row ***************************
Table: t2
Create Table: CREATE TABLE `t2` (
`a` int(11) NOT NULL COMMENT 'aaa',
PRIMARY KEY (`a`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 MAX_ROWS=1000 COMMENT='bbb'
1 row in set (0.00 sec)
Maybe, I missed something. Please, check.
[8 Aug 2007 10:02]
Bugs System
A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/32237 ChangeSet@1.2561, 2007-08-08 14:02:07+04:00, kostja@bodhi.(none) +1 -0 Apply patch for Bug#27806 table comments not passed in to storage engine during "CREATE ... LIKE ..." Only affects engine writers. No change in server behaviour.
[8 Aug 2007 10:03]
Konstantin Osipov
Queued in 5.1-runtime
[8 Aug 2007 11:51]
Konstantin Osipov
Queued in 5.1-runtime
[9 Aug 2007 13:18]
Bugs System
Pushed into 5.1.22-beta
[9 Aug 2007 13:26]
Konstantin Osipov
Internal change only.

Description: When creating table by "CREATE ... LIKE ...", table comment is not passed into to the storage engine's ::create method. How to repeat: create table test.t1 (a int primary key comment "aaa") max_rows=1000 comment "bbb"; create table test2.t1 like test.t1; gdb trace at "create table test2.t1 like test.t1;": Breakpoint 1, ha_myisam::create (this=0x93cad00, name=0xb4b80d60 "./test2/t1", table_arg=0xb4b7f538, ha_create_info=0x93c8b60) at ha_myisam.cc:1778 1778 uint create_flags= 0, records, i; (gdb) print *ha_create_info $4 = {table_charset = 0x0, default_table_charset = 0x8715580, connect_string = { str = 0x0, length = 0}, password = 0x0, tablespace = 0x0, comment = {str = 0x0, length = 0}, data_file_name = 0x0, index_file_name = 0x0, alias = 0x93c8988 "t1", max_rows = 1000, min_rows = 0, auto_increment_value = 0, table_options = 8, avg_row_length = 0, used_fields = 0, key_block_size = 0, merge_list = {elements = 0, first = 0x0, next = 0x0}, db_type = 0x9372428, row_type = ROW_TYPE_DEFAULT, null_bits = 0, options = 0, merge_insert_method = 0, extra_size = 0, table_existed = false, frm_only = false, varchar = false, storage_media = HA_SM_DEFAULT} Suggested fix: diff -up table.cc.orig table.cc --- table.cc.orig 2007-04-13 15:46:50.000000000 +0900 +++ table.cc 2007-04-13 15:47:36.000000000 +0900 @@ -2217,6 +2217,7 @@ void update_create_info_from_table(HA_CR create_info->row_type= share->row_type; create_info->default_table_charset= share->table_charset; create_info->table_charset= 0; + create_info->comment= share->comment; DBUG_VOID_RETURN; }