From: | novnov <novnovice(at)gmail(dot)com> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: Trigger function that works with both updates and deletes? |
Date: | 2007-06-19 06:30:07 |
Message-ID: | 11189206.post@talk.nabble.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Perfect, thanks
Michael Fuhr wrote:
>
> On Mon, Jun 18, 2007 at 06:07:37PM -0700, novnov wrote:
>> First, when a record is being deleted, OLD refers to the rec just deleted
>> (or about to be deleted)?
>
> Correct.
>
>> Second, while I could write two trigger functions, one dealing with
>> add/update, the other with deletes, it's probably neater to have a single
>> trigger function and have it discriminate "am I being called for a
>> delete,
>> or an add/update?" I don't know how to determine the type record change.
>
> In PL/pgSQL you can use TG_OP. See "Trigger Procedures" in the
> documentation:
>
> http://www.postgresql.org/docs/8.2/interactive/plpgsql-trigger.html
>
> --
> Michael Fuhr
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>
>
--
View this message in context: http://www.nabble.com/Trigger-function-that-works-with-both-updates-and-deletes--tf3943732.html#a11189206
Sent from the PostgreSQL - general mailing list archive at Nabble.com.
From | Date | Subject | |
---|---|---|---|
Next Message | Albe Laurenz | 2007-06-19 08:09:56 | Re: [GENERAL] Server and Client configuration. |
Previous Message | g.hintermayer | 2007-06-19 06:17:25 | Re: Apparent Wraparound? |