Re: Trigger plpgsql function, how to test if OLD is set? - Mailing list pgsql-sql

From Jeff Kowalczyk
Subject Re: Trigger plpgsql function, how to test if OLD is set?
Date
Msg-id pan.2003.12.04.19.24.29.112299@yahoo.com
Whole thread Raw
In response to Trigger plpgsql function, how to test if OLD is set?  (Jeff Kowalczyk <jtk@yahoo.com>)
List pgsql-sql
Tomasz Myrta wrote:
> You can always check whether your trigger has been fired as insert or 
> update trigger.
> DECLARE old_orderid  integer;
> BEGIN
>    if TG_OP=''UPDATE'' then
>       old_orderid=OLD.orderid;
>    else
>       old_orderid=-1;
>    end if;

Thank you, that works well enough. I'm beginning to appreciate the
complexity of working with both the familiar DRI (contraints) and
triggers, which are something I have rarely used.



pgsql-sql by date:

Previous
From: Tomasz Myrta
Date:
Subject: Re: Trigger plpgsql function, how to test if OLD is set?
Next
From: Andre Yoshiaki Kashiwabara
Date:
Subject: ECPG and User-defined Types.