When i login to site i catch error

Feb  8 11:36:59 db postgres[2962]: [2-1] web@t1 192.168.100.106(45813) {23505} ERROR:  duplicate key value violates unique constraint "flag_content_fid_content_id_uid_sid_key"
Feb  8 11:36:59 db postgres[2962]: [2-2] web@t1 192.168.100.106(45813) {23505} DETAIL:  Key (fid, content_id, uid, sid)=(2, 2527, 1, 0) already exists.
Feb  8 11:36:59 db postgres[2962]: [2-3] web@t1 192.168.100.106(45813) {23505} STATEMENT:  UPDATE flag_content SET uid='1', sid='0'
Feb  8 11:36:59 db postgres[2962]: [2-4] 	WHERE  (uid = '0') AND (sid = '119') 

I try to fix this pls review my patch

CommentFileSizeAuthor
#2 flag_login_error.patch1.34 KBzviryatko
flag_login.patch1.04 KBdema502
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

zviryatko’s picture

I write another patch.

zviryatko’s picture

FileSize
1.34 KB
joachim’s picture

Status: Active » Needs work
+++ Documents/src/Drupal/drupal7/flag/flag.module	2012-04-19 16:19:07.089983076 +0300
@@ -578,6 +574,14 @@
+    if (!empty($query)) {

This seems weird to me. If a query is started, $query can't be empty.

I'd like some comments on the new bits of code to explain what's being done.

Also, this needs a run through Coder review for coding standards.