Re: Trigger.. AFTER and BEFORE with specific column changed - Mailing list pgsql-general

From Adrian Klaver
Subject Re: Trigger.. AFTER and BEFORE with specific column changed
Date
Msg-id 4F78A8D3.8040504@gmail.com
Whole thread Raw
In response to Trigger.. AFTER and BEFORE with specific column changed  (Albert <oo_O2_oo@hotmail.com>)
List pgsql-general
On 04/01/2012 11:45 AM, Albert wrote:
> *I'm trying to follow this :*
>
>
> CREATE TRIGGER check_update
>      *BEFORE* UPDATE ON accounts
>      FOR EACH ROW
>      WHEN (OLD.balance IS DISTINCT FROM NEW.balance)
>      EXECUTE PROCEDURE check_account_update();
>
> *but with AFTER instead of BEFORE. and I'm keep getting error on or near
> WHEN.

What is the error message?

> does that because i have to use BEFORE ? what if i need to execute the
> procedure after updating column and it has really changed.*

Depends what the procedure is doing. For more detail on what the WHEN
does in BEFORE and AFTER triggers see here:
http://www.postgresql.org/docs/9.0/interactive/sql-createtrigger.html

Look for the Notes section.

>
> --
> View this message in context:
http://postgresql.1045698.n5.nabble.com/Trigger-AFTER-and-BEFORE-with-specific-column-changed-tp5610712p5610712.html
> Sent from the PostgreSQL - general mailing list archive at Nabble.com.
>


--
Adrian Klaver
adrian.klaver@gmail.com

pgsql-general by date:

Previous
From: Jerry Sievers
Date:
Subject: Parameter setting in multi-statement command; I got bit today
Next
From: Tom Lane
Date:
Subject: Re: Parameter setting in multi-statement command; I got bit today