rule on update

From: "Gerhard Pfeiffer" <gp(at)bnbt(dot)de>
To: pgsql-general(at)postgresql(dot)org
Subject: rule on update
Date: 2002-02-05 03:24:39
Message-ID: courier.3C5F5077.00004474@earth
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Medi Montaseri 2002-02-05 03:43:35 need help with \df (user defined function listing)
Previous Message Philip Hallstrom 2002-02-05 02:19:05 Re: How to see sequences?