pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Jeff Kowalczyk <jtk@yahoo.com>
To: pgsql-sql@postgresql.org
Subject: Re: Trigger plpgsql function, how to test if OLD is set?
Date: Thu, 04 Dec 2003 14:24:29 -0500
Message-ID: <pan.2003.12.04.19.24.29.112299@yahoo.com> (raw)
References: <pan.2003.12.04.18.17.53.593118@yahoo.com>
	<3FCF7ECA.5060200@klaster.net>

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.




view thread (3+ messages)

Message-ID: <pan.2003.12.04.19.24.29.112299@yahoo.com>
Permalink:  ../pan.2003.12.04.19.24.29.112299@yahoo.com/
Also on:    postgresql.org/message-id/pan.2003.12.04.19.24.29.112299@yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: jtk@yahoo.com
  Subject: Re: Trigger plpgsql function, how to test if OLD is set?
  In-Reply-To: <pan.2003.12.04.19.24.29.112299@yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox