Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email

Magento Forum

Integrity constraint violation: 1452
Jr. Member
Total Posts:  16
Joined:  2008-05-06

SQLSTATE[23000]Integrity constraint violation1452 Cannot add or update a child rowa foreign key constraint fails
(`magento_vb/googleoptimizer_code`, CONSTRAINT `FK_GOOGLEOPTIMIZER_CODE_STOREFOREIGN KEY (`store_id`)

The above is the error I get when trying to update existing products in the system. I have upgraded to version 1.1.8 and the problem is still persistent.

I have not attempted to use any of the new Google features, but everything else appears to be still working OK.

Anyone have any tips to resolve this?

Kind regards



It seems that the table googleOptimizer_code is being setup as an innodb table, but core_store is not, therefore the constraint violation. I recreated the googleoptimizer_code table without the InnoDB type and the error is corrected.

Question is should this table be Innodb and if so why is core_store not?

OK after comparing another Database it seems that loads of tables in my new database were MyISAM when they should have been InnoDB. I think this is related to originally installing the DB on a Linux server and then migrating it to an OSX dev machine. I think the Linux server may have had InnoDB disabled or something like that,, thus the mess up. Resolution was to dump the database, edit the SQL to change the tables to InnoDB as required and then import the database again. Fingers crossed that this is the end of this and similar problems.

Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top