I was trying to reindex Category Products and I kept getting "There was a problem with reindexing process" error message. When I into SSH and tried 'php indexer.php --reindex catalog_category_product', I got:
Category Products 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 (
account_mage142
.mg_catalog_category_product_index
, CONSTRAINTFK_MG_CAT_CTGR_PRD_IDX_CTGR_ID_MG_CAT_CTGR_ENTT_ENTT_ID
FOREIGN KEY (category_id
) REFERENCESmg_catalog_category_entity
)' in /home/account/public_html/magento/lib/Zend/Db/Statement/Pdo.php:228
and
Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[23000]:
Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (
account_mage142
.mg_catalog_category_product_index
, CONSTRAINTFK_MG_CAT_CTGR_PRD_IDX_CTGR_ID_MG_CAT_CTGR_ENTT_ENTT_ID
FOREIGN KEY (category_id
) REFERENCESmg_catalog_category_entity
), query was: INSERT INTOmg_catalog_category_product_index
(category_id
,product_id
,position
,is_parent
,store_id
,visibility
) SELECTmg_catalog_category_product_index_idx
.category_id
,mg_catalog_category_product_index_idx
.product_id
,mg_catalog_category_product_index_idx
.position
,mg_catalog_category_product_index_idx
.is_parent
,mg_catalog_category_product_index_idx
.store_id
,mg_catalog_category_product_index_idx
.visibility
FROMmg_catalog_category_product_index_idx
ON DUPLICATE KEY UPDATEcategory_id
= VALUES(category_id
),product_id
= VALUES(product_id
),position
= VALUES(position
),is_parent
= VALUES(is_parent
),store_id
= VALUES(store_id
),visibility
= VALUES(visibility
)' in /home/account/public_html/magento/lib/Zend/Db/Statement/Pdo.php:235
I was advised to truncate the mg_catalog_category_product table but I was wondering if it is safe to do so.. will removing the data in this table have any adverse effects to the data in the Magento store?