rule on update - Mailing list pgsql-general

From Gerhard Pfeiffer
Subject rule on update
Date
Msg-id courier.3C5F5077.00004474@earth
Whole thread Raw
Responses Re: rule on update  (Jan Wieck <janwieck@yahoo.com>)
Re: rule on update  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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 by date:

Previous
From: Timothy Reaves
Date:
Subject: sequence question
Next
From: Stephan Szabo
Date:
Subject: Re: need help with \df (user defined function listing)