title: Magento Product Flat Data will not reindex
body: <p>I am having a problem with my Product Flat Index not reindexing, it only stays on processing. I went in and ran the reindex through the shell with indexer.php.</p>
  
  <p>I get a error that I do not understand a bit of, can someone help me?</p>
  
  <pre><code>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 foreign key constraint fails (`sprayfoa_store`.&amp;lt;result 2 when explaining filename '#sql-66c_ab044'&amp;gt;, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity`)' in /home/sprayfoa/public_html/store/lib/Zend/Db/Statement/Pdo.php:228
  Stack trace:
  #0 /home/sprayfoa/public_html/store/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement-&amp;gt;execute(Array)
  #1 /home/sprayfoa/public_html/store/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo-&amp;gt;_execute(Array)
  #2 /home/sprayfoa/public_html/store/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql-&amp;gt;_execute(Array)
  #3 /home/sprayfoa/public_html/store/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement-&amp;gt;execute(Array)
  #4 /home/sprayfoa/public_html/store/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&amp;gt;query('ALTER TABLE `ca...', Array)
  #5 /home/sprayfoa/public_html/store/lib/Varien/Db/Adapter/Pdo/Mysql.php(389): Zend_Db_Adapter_Pdo_Abstract-&amp;gt;query('ALTER TABLE `ca...', Array)
  #6 /home/sprayfoa/public_html/store/lib/Varien/Db/Adapter/Pdo/Mysql.php(327): Varien_Db_Adapter_Pdo_Mysql-&amp;gt;query('ALTER TABLE `ca...')
  #7 /home/sprayfoa/public_html/store/lib/Varien/Db/Adapter/Pdo/Mysql.php(2548): Varien_Db_Adapter_Pdo_Mysql-&amp;gt;raw_query('ALTER TABLE `ca...')
  #8 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(806): Varien_Db_Adapter_Pdo_Mysql-&amp;gt;addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
  #9 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(125): Mage_Catalog_Model_Resource_Product_Flat_Indexer-&amp;gt;prepareFlatTable(1)
  #10 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(115): Mage_Catalog_Model_Resource_Product_Flat_Indexer-&amp;gt;rebuild('1')
  #11 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(73): Mage_Catalog_Model_Resource_Product_Flat_Indexer-&amp;gt;rebuild(NULL)
  #12 /home/sprayfoa/public_html/store/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(303): Mage_Catalog_Model_Product_Flat_Indexer-&amp;gt;rebuild()
  #13 /home/sprayfoa/public_html/store/app/code/core/Mage/Index/Model/Process.php(159): Mage_Catalog_Model_Product_Indexer_Flat-&amp;gt;reindexAll()
  #14 /home/sprayfoa/public_html/store/app/code/core/Mage/Index/Model/Process.php(187): Mage_Index_Model_Process-&amp;gt;reindexAll()
  #15 /home/sprayfoa/public_html/store/shell/indexer.php(158): Mage_Index_Model_Process-&amp;gt;reindexEverything()
  #16 /home/sprayfoa/public_html/store/shell/indexer.php(198): Mage_Shell_Compiler-&amp;gt;run()
  #17 {main}
  </code></pre>