sql - PostgreSQL duplicate key when update non-unique column -
i run query bellow on postgresql 9.3.2. can tell me why query bellow throw unique violation exception while not update unique column.
the contents table have 2 trigger insert , update other table.
execute command failed: error: duplicate key value violates unique constraint "contents_0_uk" detail: key (hash)=(\x145806e0794729ba98f16e4e8ec723cb) exists. context: sql statement "update contents cont set content = tmp.content, primitive = tmp.primitive, lang = array[lang_id(tmp.lang[1]), lang_id(tmp.lang[2]), lang_id(tmp.lang[3])], percent = tmp.percent, score = tmp.score tmp_post_bulk tmp tmp.cid = cont.id , tmp.chash_matched = true , ( cont.content != tmp.content or cont.primitive != tmp.primitive or cont.percent != tmp.percent or cont.score != tmp.score or cont.lang != array[lang_id(tmp.lang[1]), lang_id(tmp.lang[2]), lang_id(tmp.lang[3])] )" pl/pgsql function content_bulk() line 53 @ sql statement ! query is: select content_bulk();
i have find out problem same postgres, duplicate unique index
because there duplicateds row in table (unique column duplicated), when query update duplicated rows, postgresql throw exception.
i manual remove duplicated rows.
Comments
Post a Comment