On Wed, Jul 7, 2010 at 8:48 AM, Johan Andersson wrote:
>
> Hello!
>
> I am trying to write a trigger for updating a modification column and am
> having some trouble getting it to behave as I want.
>
> The trigger should set the column to the supplied value if it is set in the
> UPDATE statement a
2010/7/7 Susan Cassidy :
> Can't you check it using something like this:
>
> IF OLD.modified = NEW.modified THEN
> NEW.modified = NOW();
> END IF;
> RETURN NEW;
but this take only case where column modified was changed. There are
not a functionality for detection if user explicitly updated column
Can't you check it using something like this:
IF OLD.modified = NEW.modified THEN
NEW.modified = NOW();
END IF;
RETURN NEW;
Susan
-Original Message-
From: pgsql-general-ow...@postgresql.org
[mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Johan Andersson
Sent: Wednesday, July 0
2010/7/7 Johan Andersson :
>
> Hello!
>
> I am trying to write a trigger for updating a modification column and am
> having some trouble getting it to behave as I want.
>
> The trigger should set the column to the supplied value if it is set in the
> UPDATE statement and to the current timestamp [N