Re: "Cannot insert a duplicate key..." -- SOLVED
Will Trillich <will@serensoft.com>
From: will trillich <will@serensoft.com>
To: pgsql-general@postgresql.org
Date: 2003-02-07T08:45:50Z
Lists: pgsql-general
On Thu, Feb 06, 2003 at 10:35:36PM -0500, Tom Lane wrote: > 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. you couldn't be more correct, dang it. <alert OP=idiot> well of course i left something out. i was actually inserting to a view, and a rule was inserting in the actual table. turns out, i'd forgotten to specify the WHERE id=OLD.id claus in the rule. </alert> <blush>feeling MUCH better now.</blush> apologies for the bandwidth bloat. sometimes all it takes is pressing "send" to reveal one's own density to the world -- and to one's self. -- There are 10 kinds of people: ones that get binary, and ones that don't. will@serensoft.com http://sourceforge.net/projects/newbiedoc -- we need your brain! http://www.dontUthink.com/ -- your brain needs us! Looking for a firewall? Do you think smoothwall sucks? You're probably right... Try the folks at http://clarkconnect.org/ !