Re: Views + Rules + Triggers + 7.3.2 = Upgrade Problems (was: Re: REWRITE_INVOKE_MAX and "query may contain cycles" ) - Mailing list pgsql-general

From Tom Lane
Subject Re: Views + Rules + Triggers + 7.3.2 = Upgrade Problems (was: Re: REWRITE_INVOKE_MAX and "query may contain cycles" )
Date
Msg-id 7292.1047577908@sss.pgh.pa.us
Whole thread Raw
In response to Re: Views + Rules + Triggers + 7.3.2 = Upgrade Problems (was: Re: REWRITE_INVOKE_MAX and "query may contain cycles" )  (Eric B.Ridge <ebr@tcdi.com>)
Responses Re: Views + Rules + Triggers + 7.3.2 = Upgrade Problems (was: Re: REWRITE_INVOKE_MAX and "query may contain cycles" )  (Eric B.Ridge <ebr@tcdi.com>)
List pgsql-general
"Eric B. Ridge" <ebr@tcdi.com> writes:
> I would have expected "id" to be '1' in both rows.  In fact, for what
> I'm trying to do, it's a requirement.

Then use a trigger to capture the inserted row...

> Can anyone explain why NEW.id is being re-evaluated for each statement
> in the rule?  Is this by design?

Because the rule is a macro.  Yes, it's by design.

            regards, tom lane

pgsql-general by date:

Previous
From: Eric B.Ridge
Date:
Subject: Re: Views + Rules + Triggers + 7.3.2 = Upgrade Problems (was: Re: REWRITE_INVOKE_MAX and "query may contain cycles" )
Next
From: Eric B.Ridge
Date:
Subject: Re: Views + Rules + Triggers + 7.3.2 = Upgrade Problems (was: Re: REWRITE_INVOKE_MAX and "query may contain cycles" )