Re: automatically updated an attribute with the current time

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: automatically updated an attribute with the current time
Дата
Msg-id 014d01c1a48a$5a5f4640$77de010a@billshaw.com
обсуждение исходный текст
Ответ на Re: automatically updated an attribute with the current time  ("Jules Alberts" <julesa@arbodienst-limburg.nl>)
Список 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 по дате отправления:

Предыдущее
От: "Mark Bleeker"
Дата:
Сообщение: Re: automatically updated an attribute with the current time
Следующее
От: cromwell@softhome.net (cromwell)
Дата:
Сообщение: trigger envy