How to fix

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`virtue`.`catalog_product_index_tier_price`, CONSTRAINT `CAT_PRD_IDX_TIER_PRICE_ENTT_ID_SEQUENCE_PRD_SEQUENCE_VAL` F…

Date
May 18, 2018
Collection
Field Notes
Reading time
1 min read
Type
Note
Archive status
Written by Fiifi

From the archive: Originally shared on 2018-05-18 through fiifiphp. Language, links, and opinions reflect their original context.

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`virtue`.`catalog_product_index_tier_price`, CONSTRAINT `CAT_PRD_IDX_TIER_PRICE_ENTT_ID_SEQUENCE_PRD_SEQUENCE_VAL` FOREIGN KEY (`entity_id`) REFERENCES `sequence_product` (`sequence_value`) ON), query was: INSERT INTO `catalog_product_index_tier_price` SELECT `tp`.`row_id`, `cg`.`customer_group_id`, `cw`.`website_id`, MIN(tp.value) FROM `catalog_product_entity_tier_price` AS `tp`
INNER JOIN `catalog_product_entity` AS `e` ON tp.row_id = e.row_id AND (e.created_in <= ‘1498827555’ AND e.updated_in > ’1498827555’)
INNER JOIN `customer_group` AS `cg` ON tp.all_groups = 1 OR (tp.all_groups = 0 AND tp.customer_group_id = cg.customer_group_id)
INNER JOIN `store_website` AS `cw` ON tp.website_id = 0 OR tp.website_id = cw.website_id WHERE (cw.website_id != 0) AND (e.type_id=’bundle’) GROUP BY `tp`.`row_id`,
`cg`.`customer_group_id`,
`cw`.`website_id` ON DUPLICATE KEY UPDATE `min_price` = VALUES(`min_price`)