Re: [GENERAL] rule creating infinite recursion not sure why

2007-02-16 Thread Alvaro Herrera
Gene wrote: > I was trying to create a rule to set a column to false whenever another > column was changed: Don't. Use a BEFORE trigger, and instead of issuing a new UPDATE, just change the NEW record that you return. It's conceptually much simpler. -- Alvaro Herrera

Re: [GENERAL] rule creating infinite recursion not sure why

2007-02-16 Thread Andreas Kretschmer
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 > >

Re: [GENERAL] rule creating infinite recursion not sure why

2007-02-16 Thread Tom Lane
Gene <[EMAIL PROTECTED]> writes: > I'm not sure why it's detecting recursion in this case when the rule > conditional should be false Rules are macros, which means that expansion has to terminate statically, not dynamically. For the particular purpose you seem to have here, it'd be a lot more man