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'