update in rule

Поиск
Список
Период
Сортировка
От Nicolas KOWALSKI
Тема update in rule
Дата
Msg-id vqobsj6qiw5.fsf@brevent.imag.fr
обсуждение исходный текст
Ответы Re: update in rule  (Stephan Szabo <sszabo@megazone23.bigpanda.com>)
Список pgsql-admin
Hello.

We are running PostgreSQL 7.1.3 on Debian GNU/Linux.
We maintain for our intranet something like an addressbook :

<base>=# \d adresses
                                 Table "adresses"
  Attribute   |          Type          |                 Modifier

--------------+------------------------+----------------------------------------
 id           | integer                | default nextval('adresses_id_seq'::text)
<snip>
 date_maj     | date                   | default 'NOW'
Index: adresses_pkey


I would like to automatically update the `date_maj' field with the
current day date whenever an update on a row occurs.

So I created a rule like :

CREATE RULE adresses_date_maj
AS ON UPDATE TO adresses
DO UPDATE adresses SET date_maj = 'NOW' ;


But as says the documentation, this does not work (circular problem).

Does anyone known how to achieve such a behaviour ?

Thanks in advance,
Nicolas.

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

Предыдущее
От: Fabio Serra
Дата:
Сообщение: PG on Suse
Следующее
От: Stefan Huber
Дата:
Сообщение: Re: PG on Suse