I am getting this error when I try to re-index the Attribute's Index on my magento site.

Here is a excerpt from the image below

exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (cmc_mag.catalog_product_index_eav, CONSTRAINT FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT FOREIGN KEY (entity_id) REFERENCES catalog_product_entity (entity_id) ON DELETE CASCADE O)' in /home/cmcadm1n/public_html/lib/Zend/Db/Statement/Pdo.php:228

enter image description here

Any help would be appreciated.

1 Answer 1


Enable magento DB logging via: lib/Varien/Db/Adapter/Pdo/Mysql.php .

protected $_debug = false; protected $_logAllQueries = false; protected $_logCallStack = false; protected $_debugFile = ‘var/debug/sql.txt’;

Change all to true and then run the re-index. Then check the log file specified above.

Remove the column that shouldn't be there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.