Integrity constraint violation: 1062 Duplicate entry '3-2-9' for key 'PRIMARY', query was: ALTER TABLE catalog_category_product_index_tmp ADD CONSTRAINT PRIMARY KEY (category_id,product_id,store_id), COMMENT='Catalog Category Product Indexer temporary table' enter image description here

this error come when i run setup:upgrade command in magento 2 please make some suggestions to get rid off this error

  • can you show your schema file? – Mohit Rane Jul 18 '19 at 9:16
  • i could not understand which file i show u..? – Shan Haider Jul 18 '19 at 10:40
  • installschema.php file – Mohit Rane Jul 18 '19 at 10:57
  • please tell me which location exist this file...? – Shan Haider Jul 18 '19 at 11:01
  • you said error comes start of schema creation/update right? then you must be creating table right? , file will be at app/code/Vendor/Module/Setup/ folder – Mohit Rane Jul 18 '19 at 11:35

Check in which module is stuck the setup:upgrade and apply one of the solutions welpixel : How to fix Integrity constraint violation

or go in your database and remove the duplicated manualy, following the logic @dev_67Commerce suggested : Duplicate entry - Magento 2 Ask Question,

  • error come start of schema creation/update – Shan Haider Jul 18 '19 at 8:59
  • i mean wich module get stucked – Ylgen Guxholli Jul 18 '19 at 9:16
  • see my updated question – Shan Haider Jul 18 '19 at 10:11
  • Follow the second link i showed to you – Ylgen Guxholli Jul 18 '19 at 12:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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