Magento Forum

PLEASE help… Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails
 
cmiller1014
Jr. Member
 
Total Posts:  24
Joined:  2009-03-31
 

After a clean move to a new server, we thought all was well but now we get this when trying to update products in the admin. We have exhausted all resources. I see there are a TON of people with similar problems but very few answers. I understand that there is a SQL query that can be run that will show the records which aren’t matched up correctly or something but I have no idea how do to it for this error. :(

Can you help? My error is a little different that what others are seeing.

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`338528_csp/catalog_product_entity_tier_price`, CONSTRAINT `FK_CATALOG_PRODUCT_ENTITY_TIER_PRICE_GROUP` FOREIGN KEY (`customer_group_id`) REFERENCES `customer_group` (`customer_group_id`) ON D)

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
 
cmiller1014
Jr. Member
 
Total Posts:  24
Joined:  2009-03-31
 

Can someone please help? I think this has to do with exporting my database and then reimporting it via phpmyadmin. I just need to know how to fix it.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Matt Bourne
Jr. Member
 
Total Posts:  4
Joined:  2007-09-08
 

I need help with this too!

 
Magento Community Magento Community
Magento Community
Magento Community
 
brianfeister
Jr. Member
 
Total Posts:  8
Joined:  2009-07-16
 

Here’s the Wiki on migrating Magento to a new server… in my opinion it would be a waste of time to try to muck through the database that you currently have, it seems it must be compromised,

http://www.magentocommerce.com/wiki/groups/227/moving_magento_to_another_server

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

Well, that particular error was probably because he did a MySQL dump outside of Magento and missed the proper setup commands

See:  http://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html#sqlmode_no_auto_value_on_zero

There are a few tables in Magento that use 0 as a special ID.  Without the proper setup prior to the import, MySQL will treat those zeros the same as a NULL and generate a new ID.

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