Reputation: 152
I know everyone thinks this is the same question that's been posted before but I have tried the other answers
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 f oreign key constraint fails (`Riders`. <result 2 when explaining filename '#sql-634_21fc81'>, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID _CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`enti)' in /home/.sites/143/site2/web/lib/Ze nd/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/.sites/143/site2/web/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement- >execute(Array)
#1 /home/.sites/143/site2/web/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/.sites/143/site2/web/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/.sites/143/site2/web/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/.sites/143/site2/web/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Arr ay)
#5 /home/.sites/143/site2/web/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home/.sites/143/site2/web/lib/Varien/Db/Adapter/Pdo/Mysql.php(340): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /home/.sites/143/site2/web/lib/Varien/Db/Adapter/Pdo/Mysql.php(2569): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca.. .')
#8 /home/.sites/143/site2/web/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.p hp(816): Varien_Db_Adapter_Pdo_Mysql ->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/.sites/143/site2/web/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.p hp(1390): Mage_Catalog_Model_Resourc e_Product_Flat_Indexer->prepareFlatTable(1)
#10 /home/.sites/143/site2/web/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product _Flat_Indexer->reindexAll()
#11 /home/.sites/143/site2/web/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Ind exer->reindexAll()
#12 /home/.sites/143/site2/web/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAl l()
#13 /home/.sites/143/site2/web/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /home/.sites/143/site2/web/shell/indexer.php(158): Mage_Index_Model_Process->reindexEverything()
#15 /home/.sites/143/site2/web/shell/indexer.php(198): Mage_Shell_Compiler->run()
#16 {main}
I removed all rows that existed in catalog product entity but not in catalog category product. I ran the database repair tool as well. It says that my database is not corrupted. I also tried truncating the table. None of those has resolved the problem.
At the moment my catalog_product_flat table is empty.
I'm not sure what else to try but I really need to correct this error to move on to the next part of my project. I'd be more than happy to start from scratch but this is a live site with live products and orders going on.
Any advice or help would be extremely appreciated.
Upvotes: 1
Views: 7452
Reputation: 867
Truncate:
catalog_product_flat_1
catalog_product_flat_2
catalog_product_flat_3
catalog_product_flat_cl
Reindex manually:
php /yoursite/shell/indexer.php --reindexall
Greetings.
Upvotes: 4
Reputation: 374
Upvotes: 4