Re: plpgsql trigger function with arguments

From: Colin Fox <cfox(at)cfconsulting(dot)ca>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: plpgsql trigger function with arguments
Date: 2004-03-03 12:22:17
Message-ID: pan.2004.03.03.12.22.14.640395@cfconsulting.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, 02 Mar 2004 21:35:27 -0600, Karl O. Pinc wrote:

<..>>
> CREATE TRIGGER pregs_insert_trigger
> AFTER INSERT
> ON pregs FOR EACH ROW
> EXECUTE PROCEDURE pregs_func('insert');
>
> CREATE TRIGGER pregs_update_trigger
> AFTER UPDATE
> ON pregs FOR EACH ROW
> EXECUTE PROCEDURE pregs_func('update');
>

According to the docs, this is unnecessary. A trigger function
automatically has a number of variables instantiated for it:

http://www.postgresql.org/docs/7.3/static/plpgsql-trigger.html#plpgsqltrigger

The TG_OP variable contains 'INSERT','UPDATE' or 'DELETE'.

--
Colin Fox
President
CF Consulting Inc.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message satish satish 2004-03-03 12:27:33 Data Corruption in case of abrupt failure
Previous Message Will Newton 2004-03-03 11:19:15 Selecting reals into doubles