On Product Save from Magento admin getting the Integrity constraint violation error, Can any one please let me know why this errors coming up.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '23100-1' `for key 'UNQ_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID'`


| improve this question | | | | |
  • do reindex from system->indexmanagment and try again – Murtuza Zabuawala Oct 12 '16 at 11:18
  • done but it is not happening, getting the same error – ImranSheik Oct 13 '16 at 9:42

I figure out the issue.


Magento website is connected with store manager for product create/update, due to some unknown reason/configurations, some of the products got deleted from Magento website and index not happened properly.

Due to which some products left as orphans in cataloginventory-stock-item table.

When I checked the number of records in catalog_product_entity and cataloginventory_stock_item tables, they differed in count.

select count(*) from catalog_product_entity
select count(*) from cataloginventory_stock_item

I have taken the cataloginventory_stock_item table backup, truncated the table and once again run the inventory index from terminal.

Index run successfully now and the count of the above two tables also got match and the issue of creating product from admin got resolved, as there are no more orphan records left in cataloginventory_stock_item table.

| improve this answer | | | | |

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.