| Justin Swanhart ( @ 2008-08-26 19:29:00 |
MySQL bug #31031
I came across this behavior today while writing some additional comprehensive ALTER TABLE tests for use in the test suite that we run against the Kickfire database appliance to ensure quality.
mysql> CREATE TABLE `t1` (
-> `col1` tinyint(4) DEFAULT NULL,
-> `id` int(11) NOT NULL DEFAULT '0' COMMENT 'min=1,max=65535',
-> PRIMARY KEY (`id`)
-> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.00 sec)
mysql> alter table t1 drop column id,
-> add column id int auto_increment primary key;
ERROR 1089 (HY000): Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
This is a regression in 5.0 (and 5.1, I didn't try 6) that was reported almost one year ago. This alter table works just fine in 4.1 and there isn't any reason it should complain about 'prefix index length' when there are no prefix indexes involved.
Ask MySQL to fix this regression in 5.0 before 5.1 GA.
http://bugs.mysql.com/bug.php?id=31031
I came across this behavior today while writing some additional comprehensive ALTER TABLE tests for use in the test suite that we run against the Kickfire database appliance to ensure quality.
mysql> CREATE TABLE `t1` (
-> `col1` tinyint(4) DEFAULT NULL,
-> `id` int(11) NOT NULL DEFAULT '0' COMMENT 'min=1,max=65535',
-> PRIMARY KEY (`id`)
-> ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
Query OK, 0 rows affected (0.00 sec)
mysql> alter table t1 drop column id,
-> add column id int auto_increment primary key;
ERROR 1089 (HY000): Incorrect prefix key; the used key part isn't a string, the used length is longer than the key part, or the storage engine doesn't support unique prefix keys
This is a regression in 5.0 (and 5.1, I didn't try 6) that was reported almost one year ago. This alter table works just fine in 4.1 and there isn't any reason it should complain about 'prefix index length' when there are no prefix indexes involved.
Ask MySQL to fix this regression in 5.0 before 5.1 GA.
http://bugs.mysql.com/bug.php?id=31031