"Heikki Linnakangas" <[EMAIL PROTECTED]> writes:
> Tom Lane wrote:
>> Hm, the "Assert(rte->subquery != NULL)" doesn't seem right ...
>> couldn't there be non-RTE_SUBQUERY rtes in the child?

> Oh, indeed it's not okay. The original UNION ALL view is a prime example 
> of that. I didn't notice because I was testing without assertions.

Boo ...

> Hmm, do we need the copyObject() call for non-subquery RTEs? I'm 
> guessing no, because they're not modified.

Probably not.  But it strikes me that there's another sin of omission
here: function and values RTEs need to be tweaked too, because they
contain expressions thst could have uplevel Vars in them.  I'm not
certain such RTEs could appear at top level in a UNION query, but I'm
not sure they couldn't either.

I think I'd recommend continuing to copy the RTE unconditionally,
because in the cases where it's not going to be modified, there's
not enough substructure to make this expensive.

                        regards, tom lane

-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Reply via email to