Re: "Cannot insert a duplicate key..." -- SOLVED

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: "Cannot insert a duplicate key..." -- SOLVED
Date: 2003-02-07 08:45:50
Message-ID: 20030207084550.GA2933@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Feb 06, 2003 at 10:35:36PM -0500, Tom Lane wrote:
> will trillich <will(at)serensoft(dot)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(at)serensoft(dot)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/ !

In response to

Browse pgsql-general by date

  From Date Subject
Next Message will trillich 2003-02-07 08:58:34 Re: converting Oracle to postgres
Previous Message Jules Alberts 2003-02-07 07:53:41 Re: how to determine OID of the row I just inserted???