Re: Updating another table using a trigger - Mailing list pgsql-general

From Stephan Szabo
Subject Re: Updating another table using a trigger
Date
Msg-id 20040915081551.L58656@megazone.bigpanda.com
Whole thread Raw
In response to Updating another table using a trigger  (Robert Fitzpatrick <robert@webtent.com>)
List pgsql-general
On Wed, 15 Sep 2004, Robert Fitzpatrick wrote:

> I am running PostgreSQL 7.4.5 and have a trigger on a table called
> tblriskassessors which inserts, updates or delete a corresponding record
> in tblinspectors by lookup of a contact id and license number match. The
> INSERT and DELETE work fine. The UPDATE works good unless I update the
> license number. The error, at the bottom of this message, suggests the
> primary key violation. But my UPDATE in no way alters the primary key,
> which is inspector_contact_id. A manual update on tblinspectors using
> the same values works fine. There is a foreign key on tblriskassessors
> assessor_contact_id field to the primary key above. The structures of
> the two tables can be found below as well.

Are you sure that you're going in the update path and not the insert path
inside the function? Could the select/if not found be taking effect at
which point the insert occurs rather than the else block?
RAISE NOTICE might be useful to determine thise.

pgsql-general by date:

Previous
From: "Leonardo Francalanci"
Date:
Subject: what is flushed?
Next
From: David Fetter
Date:
Subject: Re: Spacing in output