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.