I get the following error while trying to reindex my magento database..
Product Flat Data index process unknown error:
exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint >violation: 1452 Cannot add or update a child row: a foreign key constraint fails >(d014505f
., CONSTRAINT >FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID
FOREIGN KEY (entity_id
) >REFERENCEScatalog_product_entity
(`e)' in >/www/htdocs/w00f5624/lib/Zend/Db/Statement/Pdo.php:228
How do i fix this??
Best Answer
as stated correctly by Sander, deleted products still present in the product flat table cause this error. Anyway, truncating the whole table will not be necessary. You can find these products by this SQL-query:
You will then have to delete these items, which can be done using this SQL-query:
Taken from here (German): http://www.avs-webentwicklung.de/nc/blog/artikel/magento-fehler-beim-index-aufbau-sofortmassnahmen.html
Ask me if u need more advise.