>>>>> "roberto" == roberto <roberto@stripped> writes:
>> Description:
roberto> AUTO_INCREMENT does not work properly on tinyint unsigned primary key
>> How-To-Repeat:
mysql> create table Test (id TINYINT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT);
roberto> Query OK, 0 rows affected (0.00 sec)
mysql> insert into Test VALUES (0);
roberto> Query OK, 1 row affected (0.00 sec)
mysql> insert into Test VALUES (0);
roberto> ERROR 1062: Duplicate entry '1' for key 1
>> Fix:
roberto> change tinyint unsigned into tinyint,
roberto> or smallint unsigned
Hi!
This is already fixed in MySQL 3.23.3:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4 to server version: 3.23.3-alpha-debug
Type 'help' for help.
mysql> create table Test (id TINYINT UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT);
Query OK, 0 rows affected (0.05 sec)
mysql> insert into Test VALUES (0);
Query OK, 1 row affected (0.02 sec)
mysql> insert into Test VALUES (0);
Query OK, 1 row affected (0.00 sec)
mysql> select * from Test;
+----+
| id |
+----+
| 1 |
| 2 |
+----+
2 rows in set (0.00 sec)
mysql> drop table Test;
Query OK, 0 rows affected (0.00 sec)
Regards,
Monty