Gene <[EMAIL PROTECTED]> schrieb:

> 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 = _o_l_d_._i_d
> 
> pattern | id
> 12345  | 1
> 
> => update criterion set pattern = '12345' where id = 1;
> ERROR:  infinite recursion detected in rules for relation "criterion"

I think, you should better use a TRIGGER and modify the NEW.flag within
the Trigger. Your solution creates a new UPDATE when an UPDATE occur.


Andreas
-- 
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."    (unknow)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Reply via email to