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

Magento > 1.4.2
Jr. Member
Total Posts:  5
Joined:  2012-06-13


after upgrading Magento v1.4.1.1 to 1.4.2 i get an SQL error:

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`xxxxxxxx`., CONSTRAINT `FK_PRODUCT_ORDERED_AGGREGATED_DAILY_STORE_ID` FOREIGN KEY (`store_id`) REFERENCES `core_store` (`store_id`) ON DEL)

I found similar problems with entitiy_id due to deleted products and so on, but can’t figure out where my problem is.
In this store i use flat tables and flat catalog. I reindexed both indexes, but it’s not working.

Has someone fixed this problem?


I figured out that in sales_bestsellers_aggregated_daily there are products with store_id i.e. = 2, but in core_store there doesn’t exist this store_id. I deleted these products:

DELETE FROM `sales_bestsellers_aggregated_yearly`
WHERE store_id != "1";
DELETE FROM `sales_bestsellers_aggregated_monthly`
WHERE store_id != "1";
DELETE FROM `sales_bestsellers_aggregated_daily`
WHERE store_id != "1";

That fixed the problem.

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