顯示包含「bug」標籤的文章。顯示所有文章
顯示包含「bug」標籤的文章。顯示所有文章

2013/10/07

SQLSTATE[23000] Duplicate entry 'xxx' for key 'PRIMARY'

Problem:
When saving related product, it shows an error :
magento  SQLSTATE[23000]  Duplicate entry '959' for key 'PRIMARY'

Reason:
yes it right, the key is really duplicate in the table
after checking the related product table --- catalog_entity_product_link, the auto increment of 'link_id' is 950 but the latest record is '959', and it doesnt make sense

Solution: 
(1) increase the auto increment to 959  , SET AUTO_INCREMENT = 959
or
(2) delete the record after 950, and then save these related product again