Re: best way to auto-update a field when row is updated

Поиск
Список
Период
Сортировка
Искать
От
Larry Rosenman
Тема
Re: best way to auto-update a field when row is updated
Дата
Msg-id
200503101421.33958.ler@lerctr.org
Ответ на
Список
Дерево обсуждения
best way to auto-update a field when row is updated Henry Ortega <juandelacruz@gmail.com>
Re: best way to auto-update a field when row is updated Scott Marlowe <smarlowe@g2switchworks.com>
Re: best way to auto-update a field when row is updated Larry Rosenman <ler@lerctr.org>
On Thursday 10 March 2005 02:09 pm, Henry Ortega wrote:
> I have the following table
>
> FIELD_A        |          FIELD_B          |           TSTAMP
> ---------------------------------------------------------------------------
>----------------------------- x                              y              
>            2005-03-10 14:56:47.456431
>
> TSTAMP = not null default now()
>
> What's the best way to always auto-update TSTAMP to it's
> default value whenever the row gets updated?
> (e.g. update TABLENAME set FIELD_A='zzz' where FIELD_A='x';
> should automatically set TSTAMP to now)
>
trigger on update/insert.


> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
>                http://www.postgresql.org/docs/faq

-- 
Larry Rosenman                     http://www.lerctr.org/~ler
Phone: +1 214-351-4152                 E-Mail: ler@lerctr.org
US Mail: 3535 Gaspar Drive, Dallas, TX 75220-3611

В списке pgsql-sql по дате отправления
От: Henry Ortega
Дата:
От: Scott Marlowe
Дата:
FAQ