cancel
Showing results for 
Search instead for 
Did you mean: 

Integrity constraint violation: Cannot add or update a child row: a foreign key constraint fails

Integrity constraint violation: Cannot add or update a child row: a foreign key constraint fails

Get this error while adding product any solution for this

Screenshot_16.png

Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`db_test`.`catalog_product_super_link`, CONSTRAINT `CAT_PRD_SPR_LNK_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C), query was: INSERT INTO `catalog_product_super_link` (`product_id`,`parent_id`) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?) {"exception":"[object] (Zend_Db_Statement_Exception(code: 23000):

 

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`db_test`.`catalog_product_super_link`, CONSTRAINT `CAT_PRD_SPR_LNK_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C), query was: INSERT INTO `catalog_product_super_link` (`product_id`,`parent_id`) VALUES (?, ?), (?, ?), (?, ?), (?, ?), (?, ?) at /srv/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:110, PDOException(code: 23000):

 

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (`db_test`.`catalog_product_super_link`, CONSTRAINT `CAT_PRD_SPR_LNK_PRD_ID_CAT_PRD_ENTT_ENTT_ID` FOREIGN KEY (`product_id`) REFERENCES `catalog_product_entity` (`entity_id`) ON DELETE C) at /srv/public_html/vendor/magento/framework/DB/Statement/Pdo/Mysql.php:91)"} []