| От | Tom Lane |
|---|---|
| Тема | Re: defaults on updates |
| Дата | |
| Msg-id | 24956.1067700289@sss.pgh.pa.us обсуждение исходный текст |
| Ответ на | defaults on updates (Martin Marques <martin@bugs.unl.edu.ar>) |
| Список | pgsql-sql |
Martin Marques <martin@bugs.unl.edu.ar> writes: > Basically, I have 5 fields, one being a PK (SERIAL), 3 with information, and > the last one a timestamp field that will show the last time the register was > modified (tmodif which has a DEFAULT CURRENT_TIMESTAMP). > Now, eveytime someone modifys any, or all of the 3 information fields, > I want the tmodif field of that register to be set to now(). This is trivial to do with a trigger --- you just need something like NEW.lastmod := now();RETURN NEW; There's a complete example at the bottom of this page: http://developer.postgresql.org/docs/postgres/plpgsql-trigger.html regards, tom lane
В списке pgsql-sql по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера