Re: Trigger plpgsql function, how to test if OLD is set?

From: Jeff Kowalczyk <jtk(at)yahoo(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: Trigger plpgsql function, how to test if OLD is set?
Date: 2003-12-04 19:24:29
Message-ID: pan.2003.12.04.19.24.29.112299@yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Google Mike 2003-12-04 19:42:56 How Do I Toggle Quoted Identifiers?
Previous Message Tomasz Myrta 2003-12-04 18:36:58 Re: Trigger plpgsql function, how to test if OLD is set?