After upgade Magento 2.1.6 to 2.3.2 i am try to run php bin/magento setup:upgrade it's give below error

SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (latest.catalog_product_entity_datetime, CONSTRAINT CAT_PRD_ENTT_DTIME_ENTT_ID_CAT_PRD_ENTT_ENTT_ID FOREIGN KEY (entity_id) REFERENCES catalog_product_entity (entity_id) ON DELETE C), query was: INSERT INTO catalog_product_entity_datetime(attribute_id, store_id, entity_id, value) VALUES (:attribute_id0,:store_id0,:entity_id0,:value0),(:attribute_id1,:store_id1,:entity_id1,:value1),(:attribute_id2,:store_id2,:entity_id2,:value2) ON duplicate KEY UPDATE value = VALUES(value)

Please assist me.

enter image description here

1 Answer 1


It means that the value of column entity_id in catalog_product_entity_datetime table does not exist in catalog_product_entity table. Bear in mind that the entity_id in catalog_product_entity_* tables must reflect an existing product in catalog_product_entity table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.