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 1 of 2
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘234-0-1-343’ for key 1
 
seanstewart
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2009-10-23
 

I have been getting this error on both of my sites that I host on the same server. It shows up when saving a product and I\’m thinking it may be related to duplicating a product.

SQLSTATE[23000]Integrity constraint violation1062 Duplicate entry \'234-0-1-343\' for key 1

I\’ve tried:
- Clearing log_* in database
- Clearing Cache
- Repairing the database
- Starting with a fresh database

Nothing works. I see that this problem is very common but there\’s not many replies to topics. I will bump this thread until it gets resolved so it can benefit everyone.

 
Magento Community Magento Community
Magento Community
Magento Community
 
xmivite
Guru
 
Total Posts:  355
Joined:  2009-10-16
 

i just saw this in regards to another thread about sample data---- thank nvedia .. - if its the problem..

Check if app/etc, var, and media folders are writeable

 
Magento Community Magento Community
Magento Community
Magento Community
 
furnitureforyoultd
Enthusiast
 
Total Posts:  833
Joined:  2009-03-09
 

Use phpmyadmin and search all tables for “234-0-1-343”, that should narrow down the possible causes

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

This SQL statement is mentioned on StackOverflow to be used to find duplicate entries coming up on product inserts.

SELECT `orig`.`entity_id`, 
   `
orig`.`attribute_id`, 
   `
orig`.`store_id`, 
   `
orig`.`value` as `original_value`, 
   `
duplicated`.`value` as `duplicated_value`
FROM `catalog_product_entity_decimal` as `orig
INNER JOIN `catalog_product_entity_decimal` as `duplicated
    
ON (
         `
orig`.`entity_id` = `duplicated`.`entity_id
         AND `
orig`.`store_id` = `duplicated`.`store_id
         AND `
orig`.`attribute_id` = `duplicated`.`attribute_id`
         AND `
orig`.`value_id` > `duplicated`.`value_id`
   )
 
Magento Community Magento Community
Magento Community
Magento Community
 
lurebeauty
Sr. Member
 
Avatar
Total Posts:  229
Joined:  2009-07-06
 

thanks!  I ran that sql and it returned with “zero results” :( Im lost.  its only in the admin side that im having this issue.

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

The original error message: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘7831-0-1-187’ for key ‘PRIMARY’

Is 7831 the last product ID listed in your Manage Products grid?

And anyone else who’s had difficulties with duplicate product inserts, please feel free to step in.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lurebeauty
Sr. Member
 
Avatar
Total Posts:  229
Joined:  2009-07-06
 

Thanks for replying.  The last product id is 7908

 
Magento Community Magento Community
Magento Community
Magento Community
 
lurebeauty
Sr. Member
 
Avatar
Total Posts:  229
Joined:  2009-07-06
 

the error changes with every product save.  I just created a new product and got the same error again, but with “7909”
i just deleted that product and recreated it (and anything that was duplicated from it) and that fixed the problem!  yay! thanks for your help!

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

Great! I remember coming across this, but it was about two years ago. You did what my next (fingers crossed) suggestion was going to be.

Here’s what probably happened. You created the product and saved it. MySQL died due to the timeout and the autoincrement that was supposed to happen to assign the next product ID didn’t happen. So when you went to create the next product it was trying to assign the product ID of the previous item.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Roeltje
Jr. Member
 
Total Posts:  19
Joined:  2009-01-19
Waalwijk, Netherlands
 

Do you have an SKU with the same ID as the key that gives an error ?
I got the same error, and found out I had an SKU with the same number (both 1366 in my case), after changing the SKU number (SKU 1366, not of ID 1366), the problem disappeared and I could save the product, after that I could change the SKU back to its original number.

But since our SKU’s all have 4 digits… I wil be getting a lot more of these errors if this is the case…

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

@Roeltje

I had that happen once. It was the result of using the duplicate item button to create a new product. Somehow, and I’m not sure why, it seemed to pick up the SKU despite the fact that the SKU is blanked when doing this. I wasn’t there so it’s only a surmise, it shouldn’t have allowed a save if the user entered a duplicate SKU and tried to save.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Daniel Toma
Jr. Member
 
Total Posts:  13
Joined:  2007-09-22
 

I received the same error from an extension (OrganicInternet_SimpleConfigurableProducts) that seems not to be compatible with the latest Magento version.

 
Magento Community Magento Community
Magento Community
Magento Community
 
bugaga
Jr. Member
 
Total Posts:  8
Joined:  2009-07-26
 
Daniel Toma - 26 September 2011 02:09 AM

I received the same error from an extension (OrganicInternet_SimpleConfigurableProducts) that seems not to be compatible with the latest Magento version.

It seems to be only on 1.6? I have also the SCP and it worked before… try this:

https://github.com/organicinternet/magento-configurable-simple/issues/52

But I have 1.5 installed and this issue doesn’t work for me. Since several days I have the same error on saving products:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘5491-0-1-16071’ for key ‘PRIMARY’

And the reindexing prices doesn’t work too.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jaystudios
Jr. Member
 
Total Posts:  17
Joined:  2009-11-05
 
bugaga - 26 September 2011 08:51 AM


It seems to be only on 1.6? I have also the SCP and it worked before… try this:

https://github.com/organicinternet/magento-configurable-simple/issues/52

But I have 1.5 installed and this issue doesn’t work for me. Since several days I have the same error on saving products:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘5491-0-1-16071’ for key ‘PRIMARY’

And the reindexing prices doesn’t work too.

Thank you, that did the trick for me!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageClub
Guru
 
Avatar
Total Posts:  386
Joined:  2009-07-25
India
 

Do you mean , run this sql commands straight ?

chiefair - 08 August 2011 06:11 AM

This SQL statement is mentioned on StackOverflow to be used to find duplicate entries coming up on product inserts.

SELECT `orig`.`entity_id`, 
   `
orig`.`attribute_id`, 
   `
orig`.`store_id`, 
   `
orig`.`value` as `original_value`, 
   `
duplicated`.`value` as `duplicated_value`
FROM `catalog_product_entity_decimal` as `orig
INNER JOIN `catalog_product_entity_decimal` as `duplicated
    
ON (
         `
orig`.`entity_id` = `duplicated`.`entity_id
         AND `
orig`.`store_id` = `duplicated`.`store_id
         AND `
orig`.`attribute_id` = `duplicated`.`attribute_id`
         AND `
orig`.`value_id` > `duplicated`.`value_id`
   )
 
Magento Community Magento Community
Magento Community
Magento Community
 
gonzela2006
Member
 
Total Posts:  31
Joined:  2010-01-29
 

Hi,

Finally I found a solution for that problem “Integrity constraint violation: 1062 Duplicate entry “ here
http://phpmysqltalk.com/1099-magento-1-6-upgrade-errors-with-solutions.html

now I can save products without any problems.

Thanks

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