I get the following warning when I save the user profile edit form without making any form changes to comment notify settings. (Such as enabling notifications or switching from all comments to only replies). If I make changes to comment notify form settings then the error does not appear upon saving the form.

user warning: Duplicate entry '3' for key 'PRIMARY' query: INSERT INTO comment_notify_user_settings (uid, node_notify, comment_notify) VALUES (3, 1, 1) in C:\websites\dev_site\sites\all\modules\comment_notify\comment_notify.module on line 328.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

abaddon’s picture

are you using a mysql backend?
seems like the db_affected_rows() isnt affected by the UPDATE call, mysql and pgsql should return a valid value
i think its harmless if thats the case.. youll just get watchdog spam

walker2238’s picture

Yes I'm using MYSQL.

greggles’s picture

Title: User Warning on user profile edit form » Duplicate entry warning on saving user edit form

Definitely seems like something we should fix.

The alternate pattern is to do a select and then an update if rows are returned or an insert if not. That's not as awesome for performance, though.

ayalsule’s picture

subscribe
Same Problem /6.17


user warning: Duplicate entry '2759' for key 1 query: INSERT INTO comment_notify_user_settings (uid, node_notify, comment_notify) VALUES (2759, 0, 0) in xxxx/modules/comment_notify/comment_notify.module on line 328

greggles’s picture

I think this is caused by #805858: Affected rows inconsistent across database engines. So, I guess the solution is to just hide this error using the @ in php.

RichieRich’s picture

Yep, also seeing the same problem. I take it that there are no nasty side-effects to this, such as users receiving replies to comments which they didn't post etc?

greggles’s picture

Correct, this is cosmetic and not a functional problem.

greggles’s picture

Title: Duplicate entry warning on saving user edit form » Suppress duplicate entry warning on saving user edit form
Status: Active » Fixed
FileSize
1.32 KB

Here's a patch I just committed to 6.x - http://drupal.org/cvs?commit=434346

Thanks for your patience, folks.

Status: Fixed » Closed (fixed)

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