I found this error SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`irciycom_magento/weee_discount`, CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_WEEE_DISCOUNT_PRODUCT_ENTITY` FOREIGN KEY (`entity_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE CASC).
Can any one help me to resolve this problem?. All my tables are in InnoDB.
It seems this error is from an incorrect deleted product..., because in the table weee_discount are only lines till an incomplete (because deleted) existing product.
I restored my old database/website and search through all tableds with a “product_id” raw with following query (the catalog_category_product_index must be 2 times adjusted for each query). I deleted the reported lines.
After this the Update was successful.
SELECT * FROM catalog_category_product_index LEFT JOIN catalog_product_entity ON catalog_category_product_index.product_id = catalog_product_entity.entity_id WHERE catalog_product_entity.entity_id IS NULL
After my Migration from one to another Server all Tables were MyISAM, but in MyISAM no Tablereferenzes exist’s.
1. i go back to a Version bevore Upgrade to 1.2 (1.1.8) with the Database and the Filesystem
2. changed all Engines (except the log tables) from MyISAM to InnoDB with the script i found in the forum (attached)
3. create a Database Backup
4. execute a Script (whith i extracted from the original Database from the Verion 1.1.8) to create all references (attached)
5. on much tabled i head inconsistencies (there the SQL Script from Point 4 stops whith an error), the inconsistent raws i found with the SQL Command i posted bevore
6. restore the Backup from point 3
7. fix the Error you found in point 5
8. go to step 3 unless all references in the Table created succesfull
good Luck if you have the same issue origin (spend min. 5 hours to fix :-( )!
Still no luck for me either. I have tried all the possible solutions offered by different people but I still get the error when trying to save a product in 1.2.0.3… Post back if you ever find a solution. Thanks.
Hi, have you tried my solution? It’s a hard work but i think the only one way to bring your database in a consistent state, if your tables are in “MyISAM”. Magentocommerce is only supported with tables in “innodb”!
Hi, have you tried my solution? It’s a hard work but i think the only one way to bring your database in a consistent state, if your tables are in “MyISAM”. Magentocommerce is only supported with tables in “innodb”!
If you have a question, you can ask me anytime!
greetings from austria!
kulimuli
Thanks for your efforts, but that did not fix it for me. All my tables are innodb and I ran the sql you suggested.
innodb is one, look in your tables are there relations between other tables?
the most tables should have relations to other tables (http://www.magentocommerce.com/wiki/development/magento_database_diagram)
innodb is one, look in your tables are there relations between other tables?
the most tables should have relations to other tables (http://www.magentocommerce.com/wiki/development/magento_database_diagram)
greetings from Austria…
Kulimuli, I am not sure exactly how to check that. I did see foreign keys in there that referenced other tables if thats it what you mean.