Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#8 | 826030_silence_duplicate_record_errors.patch | 1.32 KB | greggles |
Comments
Comment #1
abaddon CreditAttribution: abaddon commentedare 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
Comment #2
walker2238 CreditAttribution: walker2238 commentedYes I'm using MYSQL.
Comment #3
gregglesDefinitely 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.
Comment #4
ayalsule CreditAttribution: ayalsule commentedsubscribe
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
Comment #5
gregglesI 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.
Comment #6
RichieRich CreditAttribution: RichieRich commentedYep, 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?
Comment #7
gregglesCorrect, this is cosmetic and not a functional problem.
Comment #8
gregglesHere's a patch I just committed to 6.x - http://drupal.org/cvs?commit=434346
Thanks for your patience, folks.