Bug #34710 partitioning broken with auto_increment values being specified
Submitted: 20 Feb 2008 22:46 Modified: 21 Feb 2008 8:28
Reporter: Morgan Tocker Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Partitions Severity:S2 (Serious)
Version:5.1.23 OS:Any
Assigned to: Assigned Account CPU Architecture:Any

[20 Feb 2008 22:46] Morgan Tocker
Description:
I wonder if it somehow relates to BUG #27405.  The main problem is that if I specify an auto_increment value once, it causes problems in auto assigning the values in the future.

How to repeat:
DROP TABLE my_partitioned_table;
CREATE TABLE my_partitioned_table (id INT NOT NULL AUTO_INCREMENT, 
my_date DATE, 
PRIMARY KEY(id,my_date)) ENGINE=INNODB
PARTITION BY HASH( MONTH(my_date) )  PARTITIONS 6;
insert into my_partitioned_table values (1, NOW());
insert into my_partitioned_table values (NULL, NOW());
insert into my_partitioned_table values (NULL, NOW());

08:33 test> CREATE TABLE my_partitioned_table (id INT NOT NULL AUTO_INCREMENT, 
    -> my_date DATE, 
    -> PRIMARY KEY(id,my_date)) ENGINE=INNODB
    -> PARTITION BY HASH( MONTH(my_date) )  PARTITIONS 6;
Query OK, 0 rows affected (0.06 sec)

08:33 test> insert into my_partitioned_table values (1, NOW());
Query OK, 1 row affected (0.00 sec)

08:33 test> insert into my_partitioned_table values (NULL, NOW());
Query OK, 1 row affected (0.01 sec)

08:33 test> insert into my_partitioned_table values (NULL, NOW());
ERROR 1022 (23000): Can't write; duplicate key in table 'my_partitioned_table'
[21 Feb 2008 8:28] Mattias Jonsson
This is a duplicate of Bug#33479 and will fixed with the patch for that bug.