-
由 Heikki Linnakangas 提交于
When the planner creates a subquery as part of grouping planning, fix the target list of the outer query to correctly refer to the outputs of the subquery. Previously, the parse tree's target list was sometimes left unchanged, so that it still contained Vars referring to the original relations, which have been pushed down to the subquery. After adding the subquery, the outer query only contains a single RTE for the subquery. We usually got away with a bogus target list in the outer query, because we had already decided how to construct the plan, and usually didn't look at the original parse tree anymore. In some cases, though, when the caller asked for it by passing 'use_root=true', we were already doing the right thing, but otherwise we didn't bother. There's little downside to fixing the target list, though, so let's do it unconditionally. Fixes https://github.com/greenplum-db/gpdb/issues/6754Reviewed-by: NMelanie Plageman <mplageman@pivotal.io>
2527110a