Bug #15147 smallint auto_increment stops at 218
Submitted: 22 Nov 2005 18:49 Modified: 29 Nov 2005 20:42
Reporter: Mark Miller Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.0 OS:Linux (Fedora Core 1 (2.4.22))
Assigned to: Bugs System CPU Architecture:Any

[22 Nov 2005 18:49] Mark Miller
Description:
smallint auto_increment primary key doesn't allow entries greater than 218.

How to repeat:
CREATE TABLE `char_tables` (
    `charorder` smallint(5) unsigned NOT NULL auto_increment,
    `char_table` char(50) NOT NULL,
    `char_label` char(100) NOT NULL,
    PRIMARY KEY  (`charorder`),
    UNIQUE KEY `char_table` (`char_table`,`char_label`));

Add 218 values...

Here's an example error:

mysql> insert char_tables set char_table = 'foo', char_label = 'bar';
ERROR 1062 (23000): Duplicate entry '219' for key 1

A table repair fixes it.
[22 Nov 2005 19:13] Jorge del Conde
I was unable to reproduce this bug under both, Windows and Linux (FC4) with 5.0.15 and 5.0.16:

|       213 | char_table-213 | char_label-213 |
|       214 | char_table-214 | char_label-214 |
|       215 | char_table-215 | char_label-215 |
|       216 | char_table-216 | char_label-216 |
|       217 | char_table-217 | char_label-217 |
|       218 | char_table-218 | char_label-218 |
+-----------+----------------+----------------+
218 rows in set (0.00 sec)

mysql> insert char_tables set char_table = 'foo', char_label = 'bar';
Query OK, 1 row affected (0.00 sec)

mysql> exit
Bye

C:\my>