Bug #29016 RENAME TABLE a to b, c to d doesn't transfer meta data
Submitted: 11 Jun 2007 11:34 Modified: 11 Jun 2007 12:00
Reporter: David Foale Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0.22 OS:Linux (mysql Ver 14.12 Distrib 5.0.22, for pc-linux-gnu (x86_64) using readline 5.1)
Assigned to: CPU Architecture:Any
Tags: auto_increment, rename

[11 Jun 2007 11:34] David Foale
Description:
Using RENAME TABLE doesn't transfer over the meta-data in information_schema.  All auto_incremenet values have to be reset, or all the information_schema tables renamed as well.

How to repeat:
Rename a table with auto_increment information.
[11 Jun 2007 12:00] Sveta Smirnova
Thank you for the report.

I can not repeat the problem with current development sources.

No metadata is broken if run following queries:

mysql> show create table test1;
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                                                                                                                        |
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test1 | CREATE TABLE `test1` (
  `memberID` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  PRIMARY KEY  (`memberID`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 | 
+-------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

mysql> rename table test1 to test11;
Query OK, 0 rows affected (0.28 sec)

mysql> show create table test11;
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table  | Create Table                                                                                                                                                                                         |
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| test11 | CREATE TABLE `test11` (
  `memberID` int(10) unsigned NOT NULL auto_increment,
  `name` varchar(255) default NULL,
  PRIMARY KEY  (`memberID`)
) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=utf8 | 
+--------+------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

select * from information_schema.tables where table_name='test11'\G
*************************** 1. row ***************************
  TABLE_CATALOG: NULL
   TABLE_SCHEMA: test
     TABLE_NAME: test11
     TABLE_TYPE: BASE TABLE
         ENGINE: MyISAM
        VERSION: 10
     ROW_FORMAT: Dynamic
     TABLE_ROWS: 7
 AVG_ROW_LENGTH: 20
    DATA_LENGTH: 140
MAX_DATA_LENGTH: 281474976710655
   INDEX_LENGTH: 2048
      DATA_FREE: 0
 AUTO_INCREMENT: 8
    CREATE_TIME: 2007-04-17 23:46:41
    UPDATE_TIME: 2007-06-03 19:24:58
     CHECK_TIME: NULL
TABLE_COLLATION: utf8_general_ci
       CHECKSUM: NULL
 CREATE_OPTIONS: 
  TABLE_COMMENT: 
1 row in set (0.03 sec)