"Heikki Linnakangas" <heikki(at)enterprisedb(dot)com> writes:
> Here we go. Now that I see it, I do like this approach better.
Hm, the "Assert(rte->subquery != NULL)" doesn't seem right ...
couldn't there be non-RTE_SUBQUERY rtes in the child? I think the
original coding was guaranteed to visit only subquery-type RTEs
but I'm much less convinced about this one. It might
be better to say
if (rte->rtekind == RTE_SUBQUERY)
IncrementVarSublevelsUp(...);
Or maybe it's okay; I'm too lazy to recheck the representation of
UNION ALL right now.
regards, tom lane