Asnwering a friend request positive leads on our site www.daimonin.org to this error message:
user warning: Duplicate entry '0' for key 'PRIMARY' query: INSERT INTO flag_friend_message VALUES(0, 'check check') in .. /modules/flag_friend/flag_friend.module on line 416.
That happens when i put in some text.
In the 2nd try without text it works.
But: The page is after the add not redirected right - it shows the yes/no page over and over.
If you add the friend over and over the other user is also shown in YOUR approval queue.
It don't harms the friend system at all - just senseless listings.
Feel free to register 2 testing account on the site if you like.
We use beta1 - is it recommend to use the dev package?
Comments
Comment #1
sirkitree commentedI see the problem, fcid was type 'int' instead of 'serial' which allows it to auto-increment. I made this change in cvs, please do a checkout from cvs, or wait for the changes to roll into the -dev package and test it out for me by then re-installing the module or hitting update.php and try this functionality again. Please report back.
Comment #2
michtoen commentedok, i update to the next dev package release and report then back
Comment #3
tracerhand commentedi've uploaded to this new dev on when i do a db update i get:
Comment #4
tracerhand commentedAnd when I add a message to a friend request, using the brand-new dev, I get:
Comment #5
sirkitree commentedAh, I forgot to reassign it as the primary key when adding it back in. I changed it around and made sure to test it this time. Thank you for your testing.
Comment #6
sirkitree commentedComment #8
dicreat commentedI'm using latest 6.x-1.x-dev with fresh install and I have this error when user approve friend's request:
Duplicate entry '0'; for key 'PRIMARY' query: INSERT INTO flag_friend_message VALUES(0, 'message') in /sites/all/modules/flag_friend/flag_friend.module at line 442.
Comment #9
sirkitree commented@dicreat - can you post lines 54 through 66 of the flag_friend.install file that you have on your system? This is a serialized field and should never hold 0 within it. I'm thinking you have an outdated version somehow.
Comment #10
dicreat commentedComment #11
sirkitree commentedI'm not sure why that period is on the line
'type' => 'text',.but the rest of this looks fine and should be incrementing as planned.Do you have access to your database where you can verify that the field 'fcid' is indeed an auto-increment field?
If you have access to mysql command line, you can run the following:
And should receive output like this:
+---------+----------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------+----------------------+------+-----+---------+----------------+
| fcid | smallint(5) unsigned | NO | PRI | NULL | auto_increment |
| message | text | NO | | | |
+---------+----------------------+------+-----+---------+----------------+
The 'Extra' column should say 'auto_increment'.
Comment #12
dicreat commentedThis is my result:
Field Type Null Key Default Extra
fcid int(11) NO PRI NULL auto_increment
message text NO NULL
I just make clean install the latest dev-version (2009-Jun-10) and I have the same error and the same table structure:
Field Type Null Key Default Extra
fcid int(11) NO PRI NULL auto_increment
message text NO NULL
When user1 send friend request to user2 with text message, there is no error and text message successfully insert into database. Then, if user2 accept friend request from user1 and enter a text message, I see the error "Duplicate entry". If user2 don't enter a text - no error happend.
Comment #13
sirkitree commentedWhat version of Flag module are you using?
Also, make sure that your flag_content table has an fcid as that is where it gets it.
Hrmm... that being said, I'm not so sure that field should be an auto-increment - but i'm not sure it hurts either.
Comment #14
dicreat commentedI'm using Flag module version 6.x-1.1.
flag_content table:
Field Type Null Key Default Extra
fcid int(10) unsigned NO PRI NULL auto_increment
fid smallint(5) unsigned NO MUL 0
content_type varchar(32) NO MUL
content_id int(10) unsigned NO 0
uid int(10) unsigned NO 0
timestamp int(10) unsigned NO 0
Comment #15
sirkitree commentedWow, I'm at a loss - the only thing I could think of was that the function flag_friend_get_fcid() was somehow failing on you, but by looking at your table definition for the flag_content table, I can't see how. Like I said, it's working for me - both on a complex platform with many modules and with a fresh install of just flag_friend and dependencies.
The next step would be to print $fcid after each call to flag_friend_get_fcid() and determine exactly where it's getting that 0 for $fcid.
Comment #16
andypostMaybe this depends on #488106: Error when approve friend request
Because $user undefined and messages going to be inserted with fcid = 0 or NULL
Comment #17
andypostMarked as duplicate of #488106: Error when approve friend request
Error happens when someone aprove pending request with message because ATM is broken in
flag_friend_form_submit()Comment #18
sirkitree commentedThis should be fixed now.
Comment #19
andypostStill not fixed but should go to #488106: Error when approve friend request