Hi

I'm getting the following error:
user warning: Duplicate entry '4' for key 'PRIMARY' query: INSERT INTO node_comments (cid, nid, pid, hostname, thread, name, uid, mail, homepage) VALUES (4, 2, 3, '192.168.0.33', '01.00/', 'admin', 1, '', '') in /srv/www/htdocs/sites/all/modules/nodecomment/nodecomment.module on line 700.
It's appearing at the top of the page whenever I have just submitted an edit of a nodecomment node, which is a forum reply from the advanced forum module.
I have reinstalled drupal and basically started from scratch in case there was some hangup in the database from my tweaking of settings, which didn't help.

It's updating the entry so I'm not sure why the error is being shown. I've just spent a couple of hours googling but not getting anything concrete enough to work with. Any ideas?

cheers,
Andrew

Comments

adalgleish’s picture

as a very temporary fix on a non-production site I've changed the code to an 'INSERT IGNORE' statement, but this doesn't help work out why the preceeding update statement is not altering any rows?

crea’s picture

Status: Active » Closed (cannot reproduce)

You may have broken database setup, as several people already reported. The problem is caused by db_affected_rows() return 0 for existing rows.
I posted a detailed explanation at http://drupal.org/node/1088106#comment-4567188
The module works for me without such issues. In case you investigate this, It would be helpful to provide a solution for people like you and I wiil be happy to put it on the project page. But I i'm not convinced that this is a bug in the module.