Magento Flat Indexing Fix
Fix for Magento error Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
db1
.#sql-a211_565
, CONSTRAINT FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID
FOREIGN KEY (entity_id
) REFERENCES catalog_product_entity
(entity_id
) ON DELETE CASCADE ON)'
Either
1 |
truncate table `catalog_product_flat_1` |
or
1 2 3 4 |
DELETE pf1.* FROM catalog_product_flat_1 pf1 LEFT JOIN catalog_product_entity p ON pf1.entity_id = p.entity_id WHERE ISNULL( p.entity_id ) |