Closed (duplicate)
Project:
Flag
Version:
7.x-2.0-beta6
Component:
Flag core
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
23 Aug 2011 at 02:22 UTC
Updated:
23 Jun 2015 at 07:15 UTC
Jump to comment: Most recent
Comments
Comment #1
drupallogic commentedsame here.
Comment #2
mylesorme commentedSimilarly on a new installation with no content.
Comment #3
tj2653 commentedNot sure if this is the same problem, but I occasionally get a similar message when flagging (Flag 7.x-2.0-beta5):
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2-2' for key 'PRIMARY': INSERT INTO {flag_counts} (fid, content_type, content_id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => 2 [:db_insert_placeholder_3] => 1 ) in flag_flag->_update_count() (line 743 of /home/my/public_html/sites/all/modules/flag/flag.inc).
Comment #4
mefisto75 commentedI have exactly the same problem but isn't this a duplicate of http://drupal.org/node/1047954
Comment #5
quicksketchFixed in #1047954: User warning: Column 'uid' in on clause is ambiguous query on Flag default views.
Comment #6
simon_s commentedI have a similar problem, but within the flac.inc file: (used version 7.x-2.0-beta6)
I'm flagging anonymous node visits (for a list of recently viewed products) using the rules module and executing these 3 flag api calls within a rule:
$flag = flag_get_flag('recently_viewed');
// Unflag node first to refresh flagging time)
$flag->flag('unflag', $node->nid);
// Flag node
$flag->flag('flag', $node->nid);
Sometimes (I haven't found a clear regularity behind it yet) an error like this thrown:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2-4' for key 1: INSERT INTO {flag_counts} (fid, content_type, content_id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => 4 [:db_insert_placeholder_3] => 2 ) in flag_flag->_update_count() (line 738 of /home/www/drupal7/sites/all/modules/flag/flag.inc).
Thanks for your help and for this great module!
Comment #7
Scott Ellis commentedHello, I believe I'm having the same problem as described in #6 except I'm not using the Rules module. I'm not sure if this is considered an open issue under beta6 or whether it should be opened as a new issue (or if I'm an idiot for asking because it's been resolved elsewhere), so I'll just describe my observations briefly and await further instruction.
My error message is this:
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '2-103' for key 1: INSERT INTO {flag_counts} (fid, content_type, content_id, count) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3); Array ( [:db_insert_placeholder_0] => 2 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => 103 [:db_insert_placeholder_3] => 1 ) in flag_flag->_update_count() (line 738 of /var/www/html/milawh/sites/all/modules/flag/flag.inc).
I am trying to use Flags to allow anonymous users to select a location (e.g., county, city, reservation, etc.) which I then use to serve content specific to the users' locations using Views. Anyway, this works perfectly when the flag_contents and flag_counts databases have corresponding entries. However, I notice that after some period of time the flag_contents database will purge itself when I set a new flag. BUT the flag_counts database does not purge itself of the entries that corresponded to the old entries in flag_contents. At this point, if I flag a location that equals one of the unpurged entries in the flag_counts database the error is thrown.
I hope this description makes sense and is at least somewhat illuminating to someone. I'm pretty new to Drupal so I wish I could help more with this bug -- if it is in fact a bug and not just my own failure to understand the solutions as they're described in other posts.
BTW, the Flags module is awesome. Keep up the good work.
Comment #8
Scott Ellis commentedHello Again, I don't know if anyone is looking at my last post (#7) but I have reverted to an older version of my site that appears to be working properly for the time being. I'm going to carefully test every module I update to see if I can determine what may have caused this problem. In any event, please ignore my last post until I have more information. Thanks and sorry for possible false bug report.
Comment #9
Roi Danton commentedI have the same problem like #3, #6, #7 when setting a flag when viewing a node. However the error message appears only the first time the node is viewed (once the flag is set/unset the error does not occur again when viewing the node at a later time):
Comment #10
Roi Danton commentedUpdate to dev version apparently fixes this problem, see also #1088672: Duplicate fid-node key error when flagging content.
Comment #11
blogook commentedEdit. nothing to report
Comment #12
zuernbernhard commentedSame Problem here, even with the Dev-Version (7.x-3.6+10-dev)