| От | 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 по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера