Can’t Re-index After Product Import in Magento

databaseimportindexingMySQL

I have a client call and say he could not re-index after importing 100 products. I attempted to re-index in shell and received this error

exception 'PDOException' with message 'SQLSTATE23000: Integrity constraint violation: 1062 Duplicate entry '9243-159-1-555' for key 'PRIMARY'' in 

I learned that the client was testing his 100 new products on the production server (and not staging), seeing that we have a Staging and Development server.

Best Answer

So I actually solved the problem so I figured it would be helpful for others to know the answer:

Firstly, I backed up and restored the production database to my local. I then looked up the attribute (ID 159) and found its model. I learned it was "Varchar"

Then I searched the database for that ID

SELECT * FROM catalog_product_entity_varchar where attribute_id = 159;

I then found the entity ID 9243 (So I could have just did a query for both)

The value was something like this '555,369,555'

I grabbed the value_id and removed the row (on my test system)

delete FROM catalog_product_entity_varchar where value_id = 1134979;

I then re-indexed and it worked!

Related Topic