MySQL Forums
Forum List  »  Newbie

Re: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row
Posted by: Peter Brawley
Date: January 21, 2019 02:01PM

Exactly as the error message says ...

- the catalog_product_index_eav.entity_id column references catalog_product_entity.entity_id

- so every catalog_product_index_eav.entity_id value must exist as a catalog_product_entity.entity_id value

- but at least one of the entity_id values you are trying to insert does not meet that criterion.

When writing code to insert or update columns which refer as foreign keys to other columns, best practice is to write a transaction which checks that the proposed insert or update meets the foreign key criterion.



Edited 1 time(s). Last edit at 01/22/2019 11:45AM by Peter Brawley.

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.