Re: rule creating infinite recursion not sure why

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: gene(at)sotech(dot)us
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: rule creating infinite recursion not sure why
Date: 2007-02-16 15:22:20
Message-ID: 27544.1171639340@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Gene <genekhart(at)gmail(dot)com> 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 manageable and a lot more efficient
to use a BEFORE UPDATE trigger instead of a rule.

if new.pattern <> old.pattern then
new.flag = false;
end if;
return new;

Or are you trying to change some other row than the one being updated?

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Andreas Kretschmer 2007-02-16 15:22:52 Re: rule creating infinite recursion not sure why
Previous Message Ron Johnson 2007-02-16 15:13:22 Re: Problem writing sql statement....