Re: "Cannot insert a duplicate key..." -- but where?
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: will trillich <will@serensoft.com>
Cc: pgsql-general@postgresql.org
Date: 2003-02-07T03:35:36Z
Lists: pgsql-general
will trillich <will@serensoft.com> writes: > in trying to UPDATE a linking-table record (the middle-man in a > many-to-many relationship) i've encountered an "ERROR: Cannot > insert a duplicate key into unique index _relations_p_r_v_ix" I tried to duplicate this, and got: ... regression-# relation.relative = r.id AND r.lname = 'b' and regression-# relation.relation_v = t.id AND t.name = 'Family'; UPDATE 1 regression=# I think there's something you left out. Given that you tested the WHERE clause by making an equivalent SELECT, I don't believe that the UPDATE is trying to update more than one row. It seems more likely that you overlooked a uniqueness conflict against some other existing row. regards, tom lane