Re: automatically updated an attribute with the current time - Mailing list pgsql-novice

From Stephan Szabo
Subject Re: automatically updated an attribute with the current time
Date
Msg-id 014d01c1a48a$5a5f4640$77de010a@billshaw.com
Whole thread Raw
In response to Re: automatically updated an attribute with the current time  ("Jules Alberts" <julesa@arbodienst-limburg.nl>)
List pgsql-novice
> create function au_col()
> returns opaque
> as  'begin
>       old.mut_id = current_user;
>       old.mut_timestamp = CURRENT_TIMESTAMP;
>       return old;
>     end;'
> language 'plpgsql';

As a note, while this works in your case, because you're changing
all the columns inside the trigger, in general, you want to be making
modifications to NEW and returning NEW on updates unless you
want to ignore the actual sets done by the update statement (which is
sometimes what you want).


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


pgsql-novice by date:

Previous
From: "Mark Bleeker"
Date:
Subject: Re: automatically updated an attribute with the current time
Next
From: cromwell@softhome.net (cromwell)
Date:
Subject: trigger envy