cancel
Showing results for 
Search instead for 
Did you mean: 

Integrity constraint violation: 1452 Cannot add or update a child row:

Integrity constraint violation: 1452 Cannot add or update a child row:

Hi guys, i have run in to this error, my hosting believe it is whats causing my time out errors all the time. However correct this is i would still like to sort it out. I am running 1.9.

 

I have not been using magento for very long so i am still new to it all. Any help will be appreciated Smiley Happy 

 

Cheers!

Zako Powell

 

 

==> var/log/exception.log <==
2017-03-24T15:49:33+00:00 DEBUG (7): Exception message: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`bearbone_mg1`.`#sql-435d_5fade4`, CONSTRAINT `FK_MG_MG_CAT_PRD_FLAT_3_ENTT_ID_MG_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `mg_catalog_product_entity` (`entity_id`) ON DELETE)
Trace: #0 /home/bearbone/public_html/shop/shop/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/bearbone/public_html/shop/shop/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/bearbone/public_html/shop/shop/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/bearbone/public_html/shop/shop/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /home/bearbone/public_html/shop/shop/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `mg...', Array)
#5 /home/bearbone/public_html/shop/shop/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `mg...', Array)
#6 /home/bearbone/public_html/shop/shop/lib/Varien/Db/Adapter/Pdo/Mysql.php(423): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `mg...')
#7 /home/bearbone/public_html/shop/shop/lib/Varien/Db/Adapter/Pdo/Mysql.php(2833): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `mg...')
#8 /home/bearbone/public_html/shop/shop/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(815): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_MG_MG_CAT_PR...', 'mg_catalog_prod...', 'entity_id', 'mg_catalog_prod...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/bearbone/public_html/shop/shop/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1389): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(3)