rule creating infinite recursion not sure why

From: Gene <genekhart(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: rule creating infinite recursion not sure why
Date: 2007-02-16 07:32:26
Message-ID: 430d92a20702152332v61d0bcc4pf26e92a3df849d43@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I was trying to create a rule to set a column to false whenever another
column was changed:

CREATE RULE...
ON UPDATE TO criterion
WHERE new.pattern::text <> old.pattern::text DO UPDATE table SET flag =
false
WHERE id = old.id

pattern | id
12345 | 1

=> update criterion set pattern = '12345' where id = 1;
ERROR: infinite recursion detected in rules for relation "criterion"

I'm not sure why it's detecting recursion in this case when the rule
conditional should be false

Thanks for any help...
gene

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bjørn T Johansen 2007-02-16 07:44:21 Re: Problem writing sql statement....
Previous Message Tom Lane 2007-02-16 06:58:28 Re: ROLE INHERIT