I deleted all feeds items for a feed node processor ("items" in my case).
Then re-imported that feed, only to see integrity constraint failures like below.
It looks like the entries in feeds_item table were not deleted? So when it re-imports, it get these failures, because the old data is still there.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'item-21608' 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] => item [:db_insert_placeholder_1] => 21608 [:db_insert_placeholder_2] => csv_m4n [:db_insert_placeholder_3] => 9 [:db_insert_placeholder_4] => 1312585065 [:db_insert_placeholder_5] => http://clicks.m4n.nl/_c?aid=21755&adid=667288&_df=true&turl=http%3A%2F%2Fwww.prettyyou.nl%2Fproduct_info.php%3Fproducts_id%3D5978%26utm_source%3Dm4nfeed%26utm_medium%3Dcpc%26utm_campaign%3Dm4n [:db_insert_placeholder_6] => [:db_insert_placeholder_7] => 989a68cb9bda3b28780423163d8201cd ) in drupal_write_record() (line 6859 of C:\Inetpub\wwwroot\shopcircuit.dev\includes\common.inc).
Comments
Comment #1
Anonymous (not verified) commentedI've done a full flush of the entire system, truncated all relevant tables, and this still happens!
As a matter of fact, the feeds_item table remains empty. No data is written.
Comment #2
Anonymous (not verified) commentedSame in dev-x. My feeds-item table is empty... still the above error occurs.
How is that even possible?
Comment #3
Anonymous (not verified) commentedReverted back to 2.x-alpha3 and the problems are gone. What was changed in alpha4 that causes this? By the way, the Feeds log does not exist at /admin/reports/dblog/feeds, but at admin/reports/feeds.
Comment #4
Anonymous (not verified) commentedAny update? This is kind of critical. The Feeds module simply no longer works, it can't import anything.
Comment #5
Anonymous (not verified) commentedAfter comparing both alpha3-alpha4 versions, I was able to solve it. I was using a custom entity type and custom hooks to run
feeds_item_info_insert($entity, $id);This was missing in alpha3, but you added it to alpha4 - good job!
So the solution to my problem was removing my custom feeds_item_* code. It was causing duplicate entry-issues.
Comment #7
carn1x commentedLooking at the dates, I assume this issue still lives in alpha4? Is it fixed in Dev?
I'm getting the following error with 7.x-2.0-alpha4
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'commerce_product-62' for key 'PRIMARY'As above, my feeds_item table is empty.
Comment #8
Anonymous (not verified) commentedHi, do you still have a custom hook_entity_insert() somewhere? In my case, the duplicate issue was caused by a duplicate implementation of that hook with
feeds_item_info_insert($entity, $id);in it.So I had to remove my custom
feeds_item_info_insert($entity, $id);, because that is in alpha4/devx now, so you don't need it yourself anymore.At least, that was my case.
Comment #9
carn1x commented@morningtime I don't believe so, I've not added such a hook myself, and this specific change was made to Commerce Feeds in the latest dev version. Advice I've been given is to uninstall Feeds in order to kill the related tables and then reinstall, I'll report back :)
Comment #10
erikhopp commentedSubscribe. I'm seeing this problem as well. Using alpha4.
Comment #11
AdamGS commentedHaving a similar problem when a rule is enabled on the event 'After saving new content'. The rule is updating a field on the imported node. I'm get the following error when importing a CSV file:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '132185-3-content_access_rid' for key 'PRIMARY'
is this the same error or do i need to create a new issue?
Comment #12
ditcheva commentedHi everyone,
I'm also seeing this. I had the node feeds working perfectly until I mapped the node id to a an id from my import file. Now I'm not longer able to import any nodes, even when I delete all the current nodes from my site.
It's important to have the ability to maintain node id's however, so simply allowing node id's to change across imports is not a good work-around.
Any updates would be much appreciated! :-)
Comment #13
ditcheva commentedUPDATE: I found out why I was getting this error. In my case it was actually coming from apache_solr, which I'm using for my search. The server was not running (because this is a test site I'm using on localhost) and so it was not updating its index data properly.
I can now insert nodes perfectly with the 7.x-2.0-alpha4 version.
Comment #14
bibo commentedAlso having this error, but disabling apache_solr/search_api doesnt seem to have much effect.
I can import some nodetypes, but not all, which is very annoying.
Comment #15
imiksuIs this error valid in 7.x-2.0-alpha5 version?
Comment #16
Ivanhoe123 commentedYes. I'm getting this randomly when importing from several sources.
Sometimes it imports all articles, sometimes it imports part and throws an error for the rest.
This is the full error:
SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '738' for key 'vid'Comment #17
imiksuI had this problem when using my custom rules action. The action basically wrapped the entity with metadata wrapper and then did some changes on entity and after that I saved it within the action callback, which caused this error.
My workaround was to basically loading a fresh copy of the entity with
commerce_product_load_multiple(array($product_id), array(), TRUE)where third argument set the$resetto beTRUE.Comment #18
twistor commentedThis is not a generic issue from integrity constraint problems. Almost every one of these is a separate issue, from what I can tell. Please open new issues if you're still having this problem.