From: | Adrian Klaver <aklaver(at)comcast(dot)net> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Cc: | Sebastian Tennant <sebyte(at)smolny(dot)plus(dot)com> |
Subject: | Re: Detecting changes to certain fields in 'before update' trigger functions |
Date: | 2008-12-01 15:55:37 |
Message-ID: | 200812010755.38141.aklaver@comcast.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On Monday 01 December 2008 7:18:51 am Sebastian Tennant wrote:
> Hi list,
>
> First steps in trigger functions and PL/pgSQL so please bear with me...
>
> How can one detect changes to certain fields in before update trigger
> functions?
>
> IF (NEW.<column-name> != OLD.<column-name>) THEN ...
>
> doesn't work, so obviously my understanding of the values of the
> varriables NEW and OLD in before update trigger functions is wrong; I
> had thought that OLD holds the record as it was before the update, and
> that NEW holds the record as it is since the update (but before the
> update has been committed)?
>
> How should one go about detecting changes to certain fields in before
> update trigger functions?
>
> Any help/advice much appreciated.
>
> Sebastian
It works here. Can you be more specific? Full function code, table schema,etc.
Thanks,
--
Adrian Klaver
aklaver(at)comcast(dot)net
From | Date | Subject | |
---|---|---|---|
Next Message | Richard Broersma | 2008-12-01 16:03:50 | Re: Detecting changes to certain fields in 'before update' trigger functions |
Previous Message | Adrian Klaver | 2008-12-01 15:40:09 | Re: Trigger before delete does fire before, but delete doesn't not happen |