Обсуждение: newbie: update timestamp trigger?

Поиск
Список
Период
Сортировка

newbie: update timestamp trigger?

От
ahnf
Дата:
Whenever a row is updated in a table with a timestamp column. How do I write a trigger to set that timestamp column to
now()or the current timestamp? 

thanks



Re: newbie: update timestamp trigger?

От
"Rodrigo De León"
Дата:
On 10/23/07, ahnf <interz12@yahoo.com> wrote:
> Whenever a row is updated in a table with a timestamp column. How do I write a trigger to set that timestamp column
tonow() or the current timestamp? 

Straight from the horse's mouth:
http://www.postgresql.org/docs/8.2/static/plpgsql-trigger.html#PLPGSQL-TRIGGER-EXAMPLE

Re: newbie: update timestamp trigger?

От
"Scott Marlowe"
Дата:
On 10/23/07, ahnf <interz12@yahoo.com> wrote:
> Whenever a row is updated in a table with a timestamp column. How do I write a trigger to set that timestamp column
tonow() or the current timestamp? 

You should be able to take a virtual chainsaw to the example on this
page and do it:

http://www.postgresql.org/docs/8.2/static/plpgsql-trigger.html