PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row












0















After created a shopping cart rule for grouped product I got that




catalog_product_attribute indexer




needs reindex.
When I tried to reindex from console I got:



Product Attributes index process unknown error:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#5 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
#7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
#8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
#9 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
#10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
#11 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
#12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
#13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
#14 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
#15 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
#16 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
#17 {main}

Next Zend_Db_Statement_Exception: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C), query was: INSERT INTO `catalog_product_index_eav` (`entity_id`, `attribute_id`, `store_id`, `value`) SELECT `catalog_product_index_eav_idx`.`entity_id`, `catalog_product_index_eav_idx`.`attribute_id`, `catalog_product_index_eav_idx`.`store_id`, `catalog_product_index_eav_idx`.`value` FROM `catalog_product_index_eav_idx` ON DUPLICATE KEY UPDATE `entity_id` = VALUES(`entity_id`), `attribute_id` = VALUES(`attribute_id`), `store_id` = VALUES(`store_id`), `value` = VALUES(`value`) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:235
Stack trace:
#0 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
#4 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
#5 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
#6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
#7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
#8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
#9 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
#10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
#11 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
#12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
#13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
#14 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
#15 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
#16 {main}


I am using Magento 1.9.3.8



All other indexers working. Site is working also.



Can anyone help me please?










share|improve this question



























    0















    After created a shopping cart rule for grouped product I got that




    catalog_product_attribute indexer




    needs reindex.
    When I tried to reindex from console I got:



    Product Attributes index process unknown error:
    PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:228
    Stack trace:
    #0 /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
    #1 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
    #2 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
    #3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
    #4 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
    #5 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
    #6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
    #7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
    #8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
    #9 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
    #10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
    #11 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
    #12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
    #13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
    #14 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
    #15 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
    #16 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
    #17 {main}

    Next Zend_Db_Statement_Exception: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C), query was: INSERT INTO `catalog_product_index_eav` (`entity_id`, `attribute_id`, `store_id`, `value`) SELECT `catalog_product_index_eav_idx`.`entity_id`, `catalog_product_index_eav_idx`.`attribute_id`, `catalog_product_index_eav_idx`.`store_id`, `catalog_product_index_eav_idx`.`value` FROM `catalog_product_index_eav_idx` ON DUPLICATE KEY UPDATE `entity_id` = VALUES(`entity_id`), `attribute_id` = VALUES(`attribute_id`), `store_id` = VALUES(`store_id`), `value` = VALUES(`value`) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:235
    Stack trace:
    #0 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
    #1 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
    #2 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
    #3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
    #4 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
    #5 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
    #6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
    #7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
    #8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
    #9 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
    #10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
    #11 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
    #12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
    #13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
    #14 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
    #15 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
    #16 {main}


    I am using Magento 1.9.3.8



    All other indexers working. Site is working also.



    Can anyone help me please?










    share|improve this question

























      0












      0








      0








      After created a shopping cart rule for grouped product I got that




      catalog_product_attribute indexer




      needs reindex.
      When I tried to reindex from console I got:



      Product Attributes index process unknown error:
      PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:228
      Stack trace:
      #0 /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
      #1 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
      #2 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
      #3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
      #4 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
      #5 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
      #6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
      #7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #9 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
      #10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
      #11 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
      #12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
      #13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
      #14 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
      #15 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
      #16 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
      #17 {main}

      Next Zend_Db_Statement_Exception: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C), query was: INSERT INTO `catalog_product_index_eav` (`entity_id`, `attribute_id`, `store_id`, `value`) SELECT `catalog_product_index_eav_idx`.`entity_id`, `catalog_product_index_eav_idx`.`attribute_id`, `catalog_product_index_eav_idx`.`store_id`, `catalog_product_index_eav_idx`.`value` FROM `catalog_product_index_eav_idx` ON DUPLICATE KEY UPDATE `entity_id` = VALUES(`entity_id`), `attribute_id` = VALUES(`attribute_id`), `store_id` = VALUES(`store_id`), `value` = VALUES(`value`) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:235
      Stack trace:
      #0 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
      #1 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
      #2 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
      #3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
      #4 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
      #5 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
      #6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
      #9 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
      #10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
      #11 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
      #12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
      #13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
      #14 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
      #15 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
      #16 {main}


      I am using Magento 1.9.3.8



      All other indexers working. Site is working also.



      Can anyone help me please?










      share|improve this question














      After created a shopping cart rule for grouped product I got that




      catalog_product_attribute indexer




      needs reindex.
      When I tried to reindex from console I got:



      Product Attributes index process unknown error:
      PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:228
      Stack trace:
      #0 /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
      #1 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
      #2 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
      #3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
      #4 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
      #5 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
      #6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
      #7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #9 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
      #10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
      #11 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
      #12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
      #13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
      #14 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
      #15 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
      #16 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
      #17 {main}

      Next Zend_Db_Statement_Exception: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`wallshoplive`.`catalog_product_index_eav`, CONSTRAINT `FK_CAT_PRD_IDX_EAV_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C), query was: INSERT INTO `catalog_product_index_eav` (`entity_id`, `attribute_id`, `store_id`, `value`) SELECT `catalog_product_index_eav_idx`.`entity_id`, `catalog_product_index_eav_idx`.`attribute_id`, `catalog_product_index_eav_idx`.`store_id`, `catalog_product_index_eav_idx`.`value` FROM `catalog_product_index_eav_idx` ON DUPLICATE KEY UPDATE `entity_id` = VALUES(`entity_id`), `attribute_id` = VALUES(`attribute_id`), `store_id` = VALUES(`store_id`), `value` = VALUES(`value`) in /home/wpaper/public_html/lib/Zend/Db/Statement/Pdo.php:235
      Stack trace:
      #0 /home/wpaper/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
      #1 /home/wpaper/public_html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
      #2 /home/wpaper/public_html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
      #3 /home/wpaper/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `ca...', Array)
      #4 /home/wpaper/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(504): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `ca...', Array)
      #5 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(179): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `ca...')
      #6 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Helper/Mysql4.php(49): Mage_Index_Model_Resource_Abstract->insertFromSelect(Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #7 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(153): Mage_Index_Model_Resource_Helper_Mysql4->insertData(Object(Mana_Filters_Resource_Indexer_Source), Object(Varien_Db_Select), 'catalog_product...', Array, false)
      #8 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Resource/Abstract.php(113): Mage_Index_Model_Resource_Abstract->insertFromTable('catalog_product...', 'catalog_product...', false)
      #9 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav/Abstract.php(54): Mage_Index_Model_Resource_Abstract->syncData()
      #10 /home/wpaper/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Indexer/Eav.php(185): Mage_Catalog_Model_Resource_Product_Indexer_Eav_Abstract->reindexAll()
      #11 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Indexer/Abstract.php(143): Mage_Catalog_Model_Resource_Product_Indexer_Eav->reindexAll()
      #12 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(212): Mage_Index_Model_Indexer_Abstract->reindexAll()
      #13 /home/wpaper/public_html/app/code/core/Mage/Index/Model/Process.php(260): Mage_Index_Model_Process->reindexAll()
      #14 /home/wpaper/public_html/shell/indexer.php(168): Mage_Index_Model_Process->reindexEverything()
      #15 /home/wpaper/public_html/shell/indexer.php(216): Mage_Shell_Compiler->run()
      #16 {main}


      I am using Magento 1.9.3.8



      All other indexers working. Site is working also.



      Can anyone help me please?







      magento-1.9 database reindex






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Jan 21 at 0:22









      G. G.G. G.

      104




      104






















          1 Answer
          1






          active

          oldest

          votes


















          0














          Solved. Solution was to run these queries after full backup:



          delete FROM `catalog_product_entity_datetime` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_decimal` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_gallery` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_group_price` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_int` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_media_gallery` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_text` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_tier_price` where entity_id not in (select entity_id from catalog_product_entity);
          delete FROM `catalog_product_entity_varchar` where entity_id not in (select entity_id from catalog_product_entity);
          delete from `catalog_category_product` WHERE product_id not in(select entity_id from catalog_product_entity);
          delete from `catalog_category_product` WHERE category_id not in(select entity_id from catalog_category_entity);
          delete from `catalog_product_website` WHERE product_id not in(select entity_id from catalog_product_entity);
          delete from `catalog_product_index_eav_idx` WHERE entity_id not in(select entity_id from catalog_product_entity);
          delete from `catalog_product_index_eav` WHERE entity_id not in(select entity_id from catalog_product_entity);
          delete from `catalog_product_link` WHERE product_id not in(select entity_id from catalog_product_entity);
          delete from `catalog_product_relation` WHERE parent_id not in(select entity_id from catalog_product_entity);





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f258488%2fpdoexception-sqlstate23000-integrity-constraint-violation-1452-cannot-add-o%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            Solved. Solution was to run these queries after full backup:



            delete FROM `catalog_product_entity_datetime` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_decimal` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_gallery` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_group_price` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_int` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_media_gallery` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_text` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_tier_price` where entity_id not in (select entity_id from catalog_product_entity);
            delete FROM `catalog_product_entity_varchar` where entity_id not in (select entity_id from catalog_product_entity);
            delete from `catalog_category_product` WHERE product_id not in(select entity_id from catalog_product_entity);
            delete from `catalog_category_product` WHERE category_id not in(select entity_id from catalog_category_entity);
            delete from `catalog_product_website` WHERE product_id not in(select entity_id from catalog_product_entity);
            delete from `catalog_product_index_eav_idx` WHERE entity_id not in(select entity_id from catalog_product_entity);
            delete from `catalog_product_index_eav` WHERE entity_id not in(select entity_id from catalog_product_entity);
            delete from `catalog_product_link` WHERE product_id not in(select entity_id from catalog_product_entity);
            delete from `catalog_product_relation` WHERE parent_id not in(select entity_id from catalog_product_entity);





            share|improve this answer




























              0














              Solved. Solution was to run these queries after full backup:



              delete FROM `catalog_product_entity_datetime` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_decimal` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_gallery` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_group_price` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_int` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_media_gallery` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_text` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_tier_price` where entity_id not in (select entity_id from catalog_product_entity);
              delete FROM `catalog_product_entity_varchar` where entity_id not in (select entity_id from catalog_product_entity);
              delete from `catalog_category_product` WHERE product_id not in(select entity_id from catalog_product_entity);
              delete from `catalog_category_product` WHERE category_id not in(select entity_id from catalog_category_entity);
              delete from `catalog_product_website` WHERE product_id not in(select entity_id from catalog_product_entity);
              delete from `catalog_product_index_eav_idx` WHERE entity_id not in(select entity_id from catalog_product_entity);
              delete from `catalog_product_index_eav` WHERE entity_id not in(select entity_id from catalog_product_entity);
              delete from `catalog_product_link` WHERE product_id not in(select entity_id from catalog_product_entity);
              delete from `catalog_product_relation` WHERE parent_id not in(select entity_id from catalog_product_entity);





              share|improve this answer


























                0












                0








                0







                Solved. Solution was to run these queries after full backup:



                delete FROM `catalog_product_entity_datetime` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_decimal` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_gallery` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_group_price` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_int` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_media_gallery` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_text` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_tier_price` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_varchar` where entity_id not in (select entity_id from catalog_product_entity);
                delete from `catalog_category_product` WHERE product_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_category_product` WHERE category_id not in(select entity_id from catalog_category_entity);
                delete from `catalog_product_website` WHERE product_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_index_eav_idx` WHERE entity_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_index_eav` WHERE entity_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_link` WHERE product_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_relation` WHERE parent_id not in(select entity_id from catalog_product_entity);





                share|improve this answer













                Solved. Solution was to run these queries after full backup:



                delete FROM `catalog_product_entity_datetime` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_decimal` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_gallery` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_group_price` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_int` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_media_gallery` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_text` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_tier_price` where entity_id not in (select entity_id from catalog_product_entity);
                delete FROM `catalog_product_entity_varchar` where entity_id not in (select entity_id from catalog_product_entity);
                delete from `catalog_category_product` WHERE product_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_category_product` WHERE category_id not in(select entity_id from catalog_category_entity);
                delete from `catalog_product_website` WHERE product_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_index_eav_idx` WHERE entity_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_index_eav` WHERE entity_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_link` WHERE product_id not in(select entity_id from catalog_product_entity);
                delete from `catalog_product_relation` WHERE parent_id not in(select entity_id from catalog_product_entity);






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 2 days ago









                G. G.G. G.

                104




                104






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f258488%2fpdoexception-sqlstate23000-integrity-constraint-violation-1452-cannot-add-o%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    An IMO inspired problem

                    Management

                    Has there ever been an instance of an active nuclear power plant within or near a war zone?