Skip site navigation (1) Skip section navigation (2)

Re: Trigger.. AFTER and BEFORE with specific column changed

From: Adrian Klaver <adrian(dot)klaver(at)gmail(dot)com>
To: Albert <oo_O2_oo(at)hotmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Trigger.. AFTER and BEFORE with specific column changed
Date: 2012-04-01 19:13:23
Message-ID: (view raw or whole thread)
Lists: 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
>      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

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:

Look for the Notes section.

> --
> View this message in context:
> Sent from the PostgreSQL - general mailing list archive at

Adrian Klaver

In response to

pgsql-general by date

Next:From: Jay LevittDate: 2012-04-01 20:14:14
Subject: Switching to Homebrew as recommended Mac install?
Previous:From: Jerry SieversDate: 2012-04-01 19:02:56
Subject: Parameter setting in multi-statement command; I got bit today

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group