Magento indexing is failing, SQLSTATE[23000]: Integrity constraint violation The Next CEO of Stack OverflowCan't re-index Category Products - SQLSTATE[23000]: Integrity constraint violation: 1452Magento 1.8 reindex allFix error “There was a problem with reindexing process.” or “Cannot initialize the indexer process.”Index Management ProblemProduct Attributes could not be reindexedSQLSTATE[42S02]: Base table or view not found: 1146 Table 'core_store' doesn't existReindex catalog categories url issueError when moving Magento File to a different domainSQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoInvalid method Yoast_MetaRobots_Block_Catalog_Product_View:MySQL cron_schedule update problem
Rotate a column
Customer Requests (Sometimes) Drive Me Bonkers!
If I blow insulation everywhere in my attic except the door trap, will heat escape through it?
Anatomically Correct Strange Women In Ponds Distributing Swords
What is the point of a new vote on May's deal when the indicative votes suggest she will not win?
Describing a person. What needs to be mentioned?
How to start emacs in "nothing" mode (`fundamental-mode`)
MAZDA 3 2006 (UK) - poor acceleration then takes off at 3250 revs
India just shot down a satellite from the ground. At what altitude range is the resulting debris field?
How to write papers efficiently when English isn't my first language?
Grabbing quick drinks
Why did we only see the N-1 starfighters in one film?
Would this house-rule that treats advantage as a +1 to the roll instead (and disadvantage as -1) and allows them to stack be balanced?
Can the Reverse Gravity spell affect the Meteor Swarm spell?
Are there languages with no euphemisms?
What does this shorthand mean?
How long to clear the 'suck zone' of a turbofan after start is initiated?
How can I get through very long and very dry, but also very useful technical documents when learning a new tool?
Why were Madagascar and New Zealand discovered so late?
Return the Closest Prime Number
How do I solve this limit?
How do I construct this japanese bowl?
Why do professional authors make "consistency" mistakes? And how to avoid them?
How should I support this large drywall patch?
Magento indexing is failing, SQLSTATE[23000]: Integrity constraint violation
The Next CEO of Stack OverflowCan't re-index Category Products - SQLSTATE[23000]: Integrity constraint violation: 1452Magento 1.8 reindex allFix error “There was a problem with reindexing process.” or “Cannot initialize the indexer process.”Index Management ProblemProduct Attributes could not be reindexedSQLSTATE[42S02]: Base table or view not found: 1146 Table 'core_store' doesn't existReindex catalog categories url issueError when moving Magento File to a different domainSQLSTATE[HY000] : General error: 2013 Lost connection to MySQL server during query in MagentoInvalid method Yoast_MetaRobots_Block_Catalog_Product_View:MySQL cron_schedule update problem
For some reason Magento indexing is failing, we haven't changed anything in the website.... And that is the weird thing! The error in shell using indexer.php:
$ php indexer.php --reindex catalog_product_flat
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 (`**********_db`.`#sql-649_47012`, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON U)' in /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(340): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2569): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
#8 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(816): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(160): Mage_Index_Model_Process->reindexEverything()
#15 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(200): Mage_Shell_Compiler->run()
#16 main
magento-1.7 indexing sql reindex
add a comment |
For some reason Magento indexing is failing, we haven't changed anything in the website.... And that is the weird thing! The error in shell using indexer.php:
$ php indexer.php --reindex catalog_product_flat
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 (`**********_db`.`#sql-649_47012`, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON U)' in /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(340): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2569): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
#8 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(816): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(160): Mage_Index_Model_Process->reindexEverything()
#15 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(200): Mage_Shell_Compiler->run()
#16 main
magento-1.7 indexing sql reindex
Check my answer on this link magento.stackexchange.com/questions/105393/… Hope this will help you
– Asish Hira
Mar 14 '16 at 7:27
add a comment |
For some reason Magento indexing is failing, we haven't changed anything in the website.... And that is the weird thing! The error in shell using indexer.php:
$ php indexer.php --reindex catalog_product_flat
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 (`**********_db`.`#sql-649_47012`, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON U)' in /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(340): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2569): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
#8 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(816): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(160): Mage_Index_Model_Process->reindexEverything()
#15 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(200): Mage_Shell_Compiler->run()
#16 main
magento-1.7 indexing sql reindex
For some reason Magento indexing is failing, we haven't changed anything in the website.... And that is the weird thing! The error in shell using indexer.php:
$ php indexer.php --reindex catalog_product_flat
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 (`**********_db`.`#sql-649_47012`, CONSTRAINT `FK_CAT_PRD_FLAT_1_ENTT_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASCADE ON U)' in /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php:228
Stack trace:
#0 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#2 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#4 /home/**********/domains/***********nna.nl/public_html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('ALTER TABLE `ca...', Array)
#5 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('ALTER TABLE `ca...', Array)
#6 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(340): Varien_Db_Adapter_Pdo_Mysql->query('ALTER TABLE `ca...')
#7 /home/**********/domains/***********nna.nl/public_html/lib/Varien/Db/Adapter/Pdo/Mysql.php(2569): Varien_Db_Adapter_Pdo_Mysql->raw_query('ALTER TABLE `ca...')
#8 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(816): Varien_Db_Adapter_Pdo_Mysql->addForeignKey('FK_CAT_PRD_FLAT...', 'catalog_product...', 'entity_id', 'catalog_product...', 'entity_id', 'CASCADE', 'CASCADE')
#9 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Resource/Product/Flat/Indexer.php(1390): Mage_Catalog_Model_Resource_Product_Flat_Indexer->prepareFlatTable(1)
#10 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Flat/Indexer.php(296): Mage_Catalog_Model_Resource_Product_Flat_Indexer->reindexAll()
#11 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Catalog/Model/Product/Indexer/Flat.php(336): Mage_Catalog_Model_Product_Flat_Indexer->reindexAll()
#12 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(209): Mage_Catalog_Model_Product_Indexer_Flat->reindexAll()
#13 /home/**********/domains/***********nna.nl/public_html/app/code/core/Mage/Index/Model/Process.php(255): Mage_Index_Model_Process->reindexAll()
#14 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(160): Mage_Index_Model_Process->reindexEverything()
#15 /home/**********/domains/***********nna.nl/public_html/shell/indexer.php(200): Mage_Shell_Compiler->run()
#16 main
magento-1.7 indexing sql reindex
magento-1.7 indexing sql reindex
edited 21 mins ago
Teja Bhagavan Kollepara
3,01241949
3,01241949
asked Jan 8 '15 at 9:56
xviloxvilo
1519
1519
Check my answer on this link magento.stackexchange.com/questions/105393/… Hope this will help you
– Asish Hira
Mar 14 '16 at 7:27
add a comment |
Check my answer on this link magento.stackexchange.com/questions/105393/… Hope this will help you
– Asish Hira
Mar 14 '16 at 7:27
Check my answer on this link magento.stackexchange.com/questions/105393/… Hope this will help you
– Asish Hira
Mar 14 '16 at 7:27
Check my answer on this link magento.stackexchange.com/questions/105393/… Hope this will help you
– Asish Hira
Mar 14 '16 at 7:27
add a comment |
2 Answers
2
active
oldest
votes
it seams that you have zombie data in the flat table for store with id 1.
The prepareFlatTable
method is trying to add a Foreign Key to the catalog_product_entity
table and that fails.
Most probably because you already have in the catalog_product_flat_store_1
table a product id that is not in the catalog_product_entity
table.
First backup your database (or at least catalog_product_flat_store_1
table), then truncate the table catalog_product_flat_store_1
.
Or you can disable the usage of the flat catalog, remove the tables catalog_product_flat_store_*
, re run the indexing then enable the usage of flat tables again.
i only have a table calledcatalog_product_flat_1
, could that be the same?
– xvilo
Jan 8 '15 at 12:59
yes. I assume you have only one store view in your instance. the1
at the end is the store view id. Magento creates one flat table for each store view.
– Marius♦
Jan 8 '15 at 13:46
Yes, Thank you for this answer, couldn't find the right one on the interwebs
– xvilo
Jan 8 '15 at 16:01
add a comment |
I have 4 languages so i truncated 4 tables.
catalog_product_flat_1, 2, 3, 4
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f51536%2fmagento-indexing-is-failing-sqlstate23000-integrity-constraint-violation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
it seams that you have zombie data in the flat table for store with id 1.
The prepareFlatTable
method is trying to add a Foreign Key to the catalog_product_entity
table and that fails.
Most probably because you already have in the catalog_product_flat_store_1
table a product id that is not in the catalog_product_entity
table.
First backup your database (or at least catalog_product_flat_store_1
table), then truncate the table catalog_product_flat_store_1
.
Or you can disable the usage of the flat catalog, remove the tables catalog_product_flat_store_*
, re run the indexing then enable the usage of flat tables again.
i only have a table calledcatalog_product_flat_1
, could that be the same?
– xvilo
Jan 8 '15 at 12:59
yes. I assume you have only one store view in your instance. the1
at the end is the store view id. Magento creates one flat table for each store view.
– Marius♦
Jan 8 '15 at 13:46
Yes, Thank you for this answer, couldn't find the right one on the interwebs
– xvilo
Jan 8 '15 at 16:01
add a comment |
it seams that you have zombie data in the flat table for store with id 1.
The prepareFlatTable
method is trying to add a Foreign Key to the catalog_product_entity
table and that fails.
Most probably because you already have in the catalog_product_flat_store_1
table a product id that is not in the catalog_product_entity
table.
First backup your database (or at least catalog_product_flat_store_1
table), then truncate the table catalog_product_flat_store_1
.
Or you can disable the usage of the flat catalog, remove the tables catalog_product_flat_store_*
, re run the indexing then enable the usage of flat tables again.
i only have a table calledcatalog_product_flat_1
, could that be the same?
– xvilo
Jan 8 '15 at 12:59
yes. I assume you have only one store view in your instance. the1
at the end is the store view id. Magento creates one flat table for each store view.
– Marius♦
Jan 8 '15 at 13:46
Yes, Thank you for this answer, couldn't find the right one on the interwebs
– xvilo
Jan 8 '15 at 16:01
add a comment |
it seams that you have zombie data in the flat table for store with id 1.
The prepareFlatTable
method is trying to add a Foreign Key to the catalog_product_entity
table and that fails.
Most probably because you already have in the catalog_product_flat_store_1
table a product id that is not in the catalog_product_entity
table.
First backup your database (or at least catalog_product_flat_store_1
table), then truncate the table catalog_product_flat_store_1
.
Or you can disable the usage of the flat catalog, remove the tables catalog_product_flat_store_*
, re run the indexing then enable the usage of flat tables again.
it seams that you have zombie data in the flat table for store with id 1.
The prepareFlatTable
method is trying to add a Foreign Key to the catalog_product_entity
table and that fails.
Most probably because you already have in the catalog_product_flat_store_1
table a product id that is not in the catalog_product_entity
table.
First backup your database (or at least catalog_product_flat_store_1
table), then truncate the table catalog_product_flat_store_1
.
Or you can disable the usage of the flat catalog, remove the tables catalog_product_flat_store_*
, re run the indexing then enable the usage of flat tables again.
answered Jan 8 '15 at 10:01
Marius♦Marius
167k28319686
167k28319686
i only have a table calledcatalog_product_flat_1
, could that be the same?
– xvilo
Jan 8 '15 at 12:59
yes. I assume you have only one store view in your instance. the1
at the end is the store view id. Magento creates one flat table for each store view.
– Marius♦
Jan 8 '15 at 13:46
Yes, Thank you for this answer, couldn't find the right one on the interwebs
– xvilo
Jan 8 '15 at 16:01
add a comment |
i only have a table calledcatalog_product_flat_1
, could that be the same?
– xvilo
Jan 8 '15 at 12:59
yes. I assume you have only one store view in your instance. the1
at the end is the store view id. Magento creates one flat table for each store view.
– Marius♦
Jan 8 '15 at 13:46
Yes, Thank you for this answer, couldn't find the right one on the interwebs
– xvilo
Jan 8 '15 at 16:01
i only have a table called
catalog_product_flat_1
, could that be the same?– xvilo
Jan 8 '15 at 12:59
i only have a table called
catalog_product_flat_1
, could that be the same?– xvilo
Jan 8 '15 at 12:59
yes. I assume you have only one store view in your instance. the
1
at the end is the store view id. Magento creates one flat table for each store view.– Marius♦
Jan 8 '15 at 13:46
yes. I assume you have only one store view in your instance. the
1
at the end is the store view id. Magento creates one flat table for each store view.– Marius♦
Jan 8 '15 at 13:46
Yes, Thank you for this answer, couldn't find the right one on the interwebs
– xvilo
Jan 8 '15 at 16:01
Yes, Thank you for this answer, couldn't find the right one on the interwebs
– xvilo
Jan 8 '15 at 16:01
add a comment |
I have 4 languages so i truncated 4 tables.
catalog_product_flat_1, 2, 3, 4
add a comment |
I have 4 languages so i truncated 4 tables.
catalog_product_flat_1, 2, 3, 4
add a comment |
I have 4 languages so i truncated 4 tables.
catalog_product_flat_1, 2, 3, 4
I have 4 languages so i truncated 4 tables.
catalog_product_flat_1, 2, 3, 4
edited Dec 31 '18 at 4:23
Teja Bhagavan Kollepara
3,01241949
3,01241949
answered Dec 31 '18 at 2:35
hakanhakan
44
44
add a comment |
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f51536%2fmagento-indexing-is-failing-sqlstate23000-integrity-constraint-violation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
Check my answer on this link magento.stackexchange.com/questions/105393/… Hope this will help you
– Asish Hira
Mar 14 '16 at 7:27