Re: Delete Trigger - Mailing list pgsql-general

From Tom Lane
Subject Re: Delete Trigger
Date
Msg-id 29324.1281801215@sss.pgh.pa.us
Whole thread Raw
In response to Delete Trigger  (Chris Berry <chrisdberry82@googlemail.com>)
List pgsql-general
Chris Berry <chrisdberry82@googlemail.com> writes:
> When I update, insert or delete to one table, I need a trigger to delete and
> possibly insert into another table. The trigger I have works for insert and
> update, but returns an error when I do a delete.

There's no "NEW" row in a delete trigger (... and the error message
should have told you that pretty explicitly ...).  You can look at the
OLD row instead.

BTW, you should probably think carefully about what the UPDATE case
is doing and whether it needs to look at NEW or OLD or a combination.

            regards, tom lane

pgsql-general by date:

Previous
From: "maxxedit@gmail.com"
Date:
Subject: heap-only tuples, and constraints
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Windows 2003 server installation issue