rule on update

Поиск
Список
Период
Сортировка
От Gerhard Pfeiffer
Тема rule on update
Дата
Msg-id courier.3C5F5077.00004474@earth
обсуждение исходный текст
Ответы Re: rule on update
Re: rule on update
Список pgsql-general
Hallo,

I have a table with a timestamp-field, which should contain the date, when
the row was last-updated.
To maintain it, I tried to create a rule:

CREATE RULE rule_entries_update_self
AS ON UPDATE TO entries where new.ent_udate=old.ent_udate DO INSTEAD
 UPDATE entries SET ent_id=new.ent_id, ent_id_parent=new.ent_id_parent,
ent_name=new.ent_name, ent_desc=new.ent_desc, ent_type=new.ent_type,
ent_uname=CURRENT_USER, ent_udate=CURRENT_TIMESTAMP WHERE ent_id=new.ent_id;

But then, doing an update it get's me:
ERROR:  query rewritten 10 times, may contain cycles

It shouldn't show me this error, because the update invoked by the rule
doesn't fulfill the condition (new.ent_udate=old.ent_udate).

I just can't see, what's wrong here.
(it's postgresql 7.1.3)

Ciao,
 Gerhard

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

Предыдущее
От: Timothy Reaves
Дата:
Сообщение: sequence question
Следующее
От: Stephan Szabo
Дата:
Сообщение: Re: need help with \df (user defined function listing)