Bug #20922 mysql removes a name of first column in a table
Submitted: 8 Jul 2006 22:27 Modified: 6 Oct 2006 15:39
Reporter: Roman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0, 4.1, 5.0.19 OS:Linux (Linux)
Assigned to: Sergei Glukhov CPU Architecture:Any

[8 Jul 2006 22:27] Roman
Description:
mysql removes a name of first column in a table after adding a column with type ENUM using the cp1251 character for ENUM).

How to repeat:
example (in cp1251 encoding) demonstrate this bug

CREATE TABLE `test` (
`primary` TINYINT NOT NULL ,
`secondary` TINYINT NOT NULL ,
PRIMARY KEY ( `primary` )
) ENGINE = MYISAM ;

ALTER TABLE `test` ADD `bug` ENUM( 'яя' ) NOT NULL ;
[10 Jul 2006 8:53] Sveta Smirnova
Thank you for the report.

Verified on Linux and Windows with last 4.1 and 5.0 BK sources as reporter says with one exception: it is repeatable only if character_set_client is not cp1251 (default latin1 in my case).
[2 Aug 2006 9:26] Sveta Smirnova
Instruction for recreating the bug:

1. Start cmd.exe
2. Type next in cmd window:

C:\My Documents>cmd.exe /k chcp 1251
Текущая кодовая страница: 1251

C:\My Documents>mysql -b -uroot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 5 to server version: 5.0.23-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> use bug20922;
Database changed
mysql> CREATE TABLE `test` (
    -> `primary` TINYINT NOT NULL ,
    -> `secondary` TINYINT NOT NULL ,
    -> PRIMARY KEY ( `primary` )
    -> ) ENGINE = MYISAM ;
Query OK, 0 rows affected (0.06 sec)

mysql> ALTER TABLE `test` ADD `bug` ENUM( 'яя' ) NOT NULL ;
Query OK, 0 rows affected (0.13 sec)
Records: 0  Duplicates: 0  Warnings: 0

mysql> show create table test;
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------+
| Table | Create Table

                         |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------+
| test  | CREATE TABLE `test` (
  `` tinyint(4) NOT NULL,
  `secondary` tinyint(4) NOT NULL,
  `bug` enum('','','') NOT NULL,
  PRIMARY KEY  (``)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 |
+-------+-----------------------------------------------------------------------
--------------------------------------------------------------------------------
-------------------------+
1 row in set (0.01 sec)

mysql>
[28 Aug 2006 10:35] 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/10921

ChangeSet@1.2547, 2006-08-28 15:52:21+05:00, gluh@mysql.com +4 -0
  Bug#20922 mysql removes a name of first column in a table
  0xFF is internal separator for SET|ENUM names. 
  If this symbol is present in SET|ENUM names then we replace it with 
  ','(deprecated symbol for SET|ENUM names) during frm creation
  and restore to 0xFF during frm opening
[11 Sep 2006 9:37] 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/11681

ChangeSet@1.2549, 2006-09-11 14:50:46+05:00, gluh@mysql.com +4 -0
  Bug#20922 mysql removes a name of first column in a table
  0xFF is internal separator for SET|ENUM names. 
  If this symbol is present in SET|ENUM names then we replace it with 
  ','(deprecated symbol for SET|ENUM names) during frm creation
  and restore to 0xFF during frm opening
[6 Oct 2006 9:05] Sergei Glukhov
Fixed in 4.1.22
[6 Oct 2006 15:39] Paul DuBois
Noted in 4.1.22 changelog.

Using ALTER TABLE to add an ENUM column with an enumeration
value containing 0xFF caused the name of the first table name to be lost.
[6 Oct 2006 15:40] Paul DuBois
...caused the name of the first table *column* to be lost.