Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 2 of 2
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘234-0-1-343’ for key 1
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

As a long term solution. Hmm…

1- “Integrity constraint violation: 1062 Duplicate entry “
Solution:
This error can be solved by disabling the unique indexes check.

 
Magento Community Magento Community
Magento Community
Magento Community
 
websymphonies
Jr. Member
 
Total Posts:  3
Joined:  2011-11-03
 

For some reason, this was happening to me when I tried to import a product CSV with more than 1 line of information.  Turns out the catalog price rules were conflicting here for some reason.  Possibly because a product was added after they were created?  I just deleted the price rules and it fixed the issue.

I noticed this by searching for the longer number ‘1340755200’ from the error message and found ths in the catalogrule_product table.

 
Magento Community Magento Community
Magento Community
Magento Community
 
SimonWatts
Jr. Member
 
Total Posts:  19
Joined:  2012-01-08
 

I am having a some what similar problem to this that doesn’t seem to be solved by any of the obvious fixes like clearing cache, reindexing, truncating, repair db through phpmyadmin, repair db through magento tool.

Magento Version : 1.6.1 CE

Server :
Dedicated server, 2 x 2.1GHz AMD Opteron 12 Core Processor, 32GB ram, Ubuntu server (14 i think)

Error message is :
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘XXXXX-1’ for key ‘UNQ_CATALOGINVENTORY_STOCK_ITEM_PRODUCT_ID_STOCK_ID’

The problem arises when creating a new product. You hit save and you are presented with this error. XXXXX is equal to the current product id that you are creating (foreign key to the catalog_product_entity table) and 1 is an entry in the cataloginventry_stock table.

The product is correctly created and everything seems in tact from a user POV once this error is removed - the product looks to be correct throughout the db including the table where the constraint error is thrown. Logic leads me to believe this means that the product models create function must be running the insert script for that portion of the product twice (at least? maybe more?).

The server was in test mode and not seeing any issues. After it moved to production there will still no issues for a while (3 months approx). This problem all of a sudden manifested (several users on the system no one can tell that they did anything to cause this error and I can not find any logs that imply anything serious happened). Since product there have been no updates to the product model, and since this is vanilla magento installation for the product side of things (nothing like simple configurable products which i have read can be an issue) this is leading me to think that some data (perhaps cause by a transaction failing and not rolling back?) is stuck in a table, this is in turn causing the code to call two (or more?) inserts on the CATALOGINVENTORY_STOCK_ITEM table.

My concern is that bad data is rapidly building up as new products are failing this process and this is subsequently effecting performance in other places (reindexing now takes what is officially considered an age).

Perhaps someone has an idea of something else I can try with this issue? Or can point me to the data that the product create methods are looking at to generate the insert statement for that table?

Any idea great appreciated.

Thanks

Simon Watts
http://www.waterirrigation.co.uk/

 
Magento Community Magento Community
Magento Community
Magento Community
 
Anand_Girish
Jr. Member
 
Avatar
Total Posts:  4
Joined:  2012-03-30
 

I tried reindexing using my script but no luck actually the problem is with the duplicate id in
cataloginventory_stock_status_idx table…

 
Magento Community Magento Community
Magento Community
Magento Community
 
pageworthy
Jr. Member
 
Total Posts:  2
Joined:  2011-08-31
 

I know this stuff is old and maybe people don’t run into this as much but I’m working on an old version of Magento right now. I’ve tried ignoring the duplicates but in my case that doesn’t work because the search module in this case can’t reindex search with the conflict just ignored. The real fix for this is to track down the real cause of the error. The error message Magento provides does not give enough info to do that. This post explains how to track it down. Finally! http://www.brownwebdesign.com/blog/2011/12/debugging-magento-duplicate-entry-database-error-2/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 2