Re: on update set default

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: on update set default
Дата
Msg-id 12931.1007929740@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: on update set default  (Doug McNaught <doug@wireboard.com>)
Список pgsql-general
Doug McNaught <doug@wireboard.com> writes:
>> Im want that on each insert, update to a table the column:
>> changed_on TIMESTAMP DEFAULT now()
>> will be set to now();

> An AFTER trigger to do this should be pretty easy.

It had better be a BEFORE trigger; AFTER is too late to affect the row
that will be stored.  But I agree that this should be a very trivial
trigger to write.  The body need be no more than

    new.changed_on := now();
    return new;

> Why don't you post
> what you've tried and we'll see where you went wrong?

            regards, tom lane

В списке pgsql-general по дате отправления:

Предыдущее
От: Francisco Reyes
Дата:
Сообщение: Questions about the upcoming 7.2?
Следующее
От: Francisco Reyes
Дата:
Сообщение: Re: Questions about the upcoming 7.2?