Re: "Cannot insert a duplicate key..." -- SOLVED - Mailing list pgsql-general

From will trillich
Subject Re: "Cannot insert a duplicate key..." -- SOLVED
Date
Msg-id 20030207084550.GA2933@mail.serensoft.com
Whole thread Raw
In response to Re: "Cannot insert a duplicate key..." -- but where?  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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/ !

pgsql-general by date:

Previous
From: "Jules Alberts"
Date:
Subject: Re: how to determine OID of the row I just inserted???
Next
From: will trillich
Date:
Subject: Re: converting Oracle to postgres