So i'm not sure what happened but the importing was working fine up until I updated views. And I'm not sure how that would even affect Feeds. This issue happens when I'm trying to import new nodes into the system from my mailbox. I have no other nodes in the system other than the importer.

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-284' for key 'PRIMARY': INSERT INTO {feeds_item} (entity_type, entity_id, id, feed_nid, imported, url, guid, hash) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7); Array ( [:db_insert_placeholder_0] => node [:db_insert_placeholder_1] => 284 [:db_insert_placeholder_2] => feedback_importer [:db_insert_placeholder_3] => 55 [:db_insert_placeholder_4] => 1363973130 [:db_insert_placeholder_5] => [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => 725208b7e0c7068d723d1488df2ffc31 ) in drupal_write_record() (line 7106 of E:\inetpub\wwwroot\MoxiesFeedback\includes\common.inc).

CommentFileSizeAuthor
#8 Feeds_error.txt3.81 KBthetech249
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jmichelgarcia’s picture

Same here.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'node-25654' for key 'PRIMARY'

fox_01’s picture

Component: Feeds Import » Code

Don't exactly know if it is the reason but i have the same error after reimporting an xml. After the first import i deleted the created nodes and now i can't import them again with the error. If so there would be a need to delete old feed items from the database if the nodes are delted.

supriyarajgopal’s picture

Subscribing..same issue :'(

fox_01’s picture

I tried completly uninstalling the module and reviewed the database if there are some tables after the uninstallation from this module, but nothing. i reinstalled the module and the issue happens again. i can't import any feed anymore.

oscardax’s picture

Same issue here. Has been importing several times with no problems, but today this is a show-stopper : /
Error details from registry log are as follows:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '799-0-all' for key 'PRIMARY': INSERT INTO {node_access} (nid, realm, gid, grant_view, grant_update, grant_delete) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5); Array ( [:db_insert_placeholder_0] => 799 [:db_insert_placeholder_1] => all [:db_insert_placeholder_2] => 0 [:db_insert_placeholder_3] => 1 [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 0 ) en node_access_write_grants() (línea 3548 de /home/ensancar/public_html/aidea.ensancarlos.es/modules/node/node.module).

This issue aside, I want to thank to maintainers and contributors for this super helpful module!! : )

thetech249’s picture

Issue summary: View changes

Same thing here.

twistor’s picture

Status: Active » Postponed (maintainer needs more info)

@oscardax, that looks like a different problem.

@thetech249, can you provide an export of your feed importer?

thetech249’s picture

FileSize
3.81 KB

Here is the export from feeds.

chilligroup’s picture

subscribe

Max1’s picture

a.gursoy’s picture

Is there any solution, same here too.

YanBoudreau’s picture

I just solved this issue in my case.

I was trying all update combinations inside my procesor mapper settings. None of them where working with only 2 products while testing.

Running my import from the /import path was just getting me "SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry "

Drush was getting me much more details through a sandbox module for "drush feeds-import --feed-id=daily10000"
WD commerce_product: PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry [error]
'100TUBES-CWBK-6H' for key 'sku': INSERT INTO {commerce_product} (revision_id, sku, title,

Why INSERT when I want to update?

Then I found this function by luck in FeedsCommerceProductProcessor.inc
protected function existingEntityId(
in it
$product_id = db_query("SELECT product_id FROM {commerce_product} WHERE sku

Then I thought about my Mapper
I noted that my XML file had a row called product_id, and I mapped it to the Mapper value product_id instead of my own field_product_id.
Bad move, in phpmyadmin, table commerce_product, I noted that product_id is an automated increasing # value

I may wrongly believe that Mapping data to product_id (me), entity_id (issuie creator), nid (#5) or revision_id is causing this 1062 error.
As soon as I deleted/modified this Mapper, everything started to update normally.

remory’s picture

I'm also having this issue -- 1062 Duplicate entry '557' for key 'vid'. I'm not using vid anywhere in my mappings, so not sure how this is happening.

MegaChriz’s picture

node_save() does an insert when $node->is_new == TRUE, even when $node->nid is set. The node module does not check whether or not a node with that ID already exists. If it finds the "is_new" property, it tries to do an insert.

After the insert, insert hooks are invoked: hook_node_insert(), hook_entity_insert() and field_attach_insert(). The node object still has the "is_new" property during that phase. That property is removed after all insert hooks are invoked. So when a node object is saved within such an insert hook, the error reported in this issue will occur. Feeds doesn't save nodes from within such an insert hook. Therefore, I don't think this is a Feeds problem.

iyyappan.govind’s picture

Same thing here, I don't what to do? Is there any solution??

abrlam’s picture

I agree with @YanBoudreau (Comment #12) that you should review your mapping settings. Also, check your tamper settings too. I got the same error and when I reviewed the mapping and tamper settings, I noticed I was using Tamper PHP (which I had it disabled during the module upgrade) in one of the fields and that caused the Feeds to throw an error. The Feeds starts again (without error) as soon as I removed the PHP plugin in the tamper settings.

fab971’s picture

I had the same issue. After 7 hours testing, downgrading, disabling some modules installed since the last time i used feeds and other thinks like that i found this article: https://www.drupal.org/node/1241042#comment-5276196 (that saved my day !).

I had a rule configured to act after saving node and when i disabled this rule everything run correctly.

MegaChriz’s picture

Category: Bug report » Support request
Status: Postponed (maintainer needs more info) » Fixed

I think my comment in #14 tells us the cause of the issue and that the problem is not in Feeds.

To debug it, search for modules that implement hook_node_insert() or hook_entity_insert(). Temporary disable the code or the module to find where the problem starts and then try to find a node_save() or entity_save() call from there.

Also, as said in #17, it could be a good idea to check your rules configurations for node save actions.

To find modules that implement hook_node_insert() or hook_entity_insert(), you can use the module_implements() function:

// Modules that implement hook_node_insert().
$modules = module_implements('node_insert');

// Modules that implement hook_entity_insert().
$modules = module_implements('entity_insert');

Setting this issue to "fixed" because I think there are enough answers here that should help in finding the culprit (and because the problem does not seem to be in Feeds).

MegaChriz’s picture

Also a good idea for debugging is to add a debug_backtrace() in node_save() and log its output to a text file for example. The last debug output before the error occurs, is the one you want to inspect.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

pennywilerra’s picture

How can i fix this problem

PDOException : SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'commerce_order-279-0-0-und' for key 'PRIMARY': INSERT INTO {field_data_commerce_order_total} (entity_type, entity_id, revision_id, bundle, delta, language, commerce_order_total_amount, commerce_order_total_currency_code, commerce_order_total_data) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8); Array ( [:db_insert_placeholder_0] => commerce_order [:db_insert_placeholder_1] => 279 [:db_insert_placeholder_2] => 5108 [:db_insert_placeholder_3] => commerce_order [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => und [:db_insert_placeholder_6] => 0 [:db_insert_placeholder_7] => EUR [:db_insert_placeholder_8] => a:1:{s:10:"components";a:1:{i:0;a:3:{s:4:"name";s:10:"base_price";s:5:"price";a:3:{s:6:"amount";i:0;s:13:"currency_code";s:3:"EUR";s:4:"data";a:0:{}}s:8:"included";b:1;}}} ) dans field_sql_storage_field_storage_write() (ligne 514 dans /home/linomatfr/public_html/modules/field/modules/field_sql_storage/field_sql_storage.module).

MegaChriz’s picture

@pennywilerra
My first thought that this error is caused in a similar way as the original reported about nodes. A module reacting on the insert of a commerce order may be saving the commerce order again, triggering another insert. The field of 'commerce_order_total' is of type 'commerce_price'. What you perhaps could do is adding a debug_backtrace() in commerce_price_field_storage_pre_insert() and log its output to a text file. Something like this:

$debug = debug_backtrace();
file_put_contents('/tmp/debug.txt', print_r($debug, TRUE), FILE_APPEND);

The last debug output before the error occurs could give you a hint on where stuff goes wrong.

Or, maybe even better, you could add a try-catch block around the query insert in field_sql_storage_field_storage_write() and add the debug_backtrace there.

try {
  // Execute the query if we have values to insert.
  if ($do_insert) {
    $query->execute();
    $revision_query->execute();
  }
}
catch (PDOException $e) {
  $debug = debug_backtrace();
  file_put_contents('/tmp/debug.txt', print_r($debug, TRUE));
}

The extra insert could be caused by any module, so when you want to fix a problem like this, you have two options:

  1. Use a debugging tool to find the cause of the problem.
  2. Trial and error removing stuff that may have influence. In case of Feeds that could be removing tampers or removing mappers. In some cases this would only hide the real problem by working around it.

Sorry if I talk so much in code, not sure if you are a coder, but to effectively solve this problem I think you need to be a coder (or else know a coder that has access to your site and wants to solve the problem for you).

lule75’s picture

In my case it was Just as simple as mapping a node id to my value which had duplicates! thanks to #12
YanBoudreau’s detailed explanation, I got insight in my issue