Let RTE_RESULT pass through, extract_grouping_collations

read_write_etc
Philip Dubé 2019-07-16 04:05:19 +00:00
parent 0528bba907
commit b9bb4388d3
3 changed files with 18 additions and 8 deletions

View File

@ -357,12 +357,13 @@ BuildAggregatePlan(Query *masterQuery, Plan *subPlan)
}
/* finally create the plan */
/* TODO no nulls */
aggregatePlan = make_aggCompat(aggregateTargetList, (List *) havingQual,
aggregateStrategy,
AGGSPLIT_SIMPLE, groupColumnCount, groupColumnIdArray,
groupColumnOpArray, NULL, NIL, NIL,
rowEstimate, subPlan);
groupColumnOpArray,
extract_grouping_collations(groupColumnList,
subPlan->targetlist),
NIL, NIL, rowEstimate, subPlan);
/* just for reproducible costs between different PostgreSQL versions */
aggregatePlan->plan.startup_cost = 0;
@ -532,13 +533,14 @@ BuildDistinctPlan(Query *masterQuery, Plan *subPlan)
Oid *distinctColumnOpArray = extract_grouping_ops(distinctClauseList);
uint32 distinctClauseCount = list_length(distinctClauseList);
/* TODO no nulls */
distinctPlan = (Plan *) make_aggCompat(targetList, NIL, AGG_HASHED,
AGGSPLIT_SIMPLE, distinctClauseCount,
distinctColumnIdArray,
distinctColumnOpArray,
NULL, NIL, NIL,
rowEstimate, subPlan);
extract_grouping_collations(
distinctClauseList,
subPlan->targetlist),
NIL, NIL, rowEstimate, subPlan);
}
else
{

View File

@ -676,7 +676,11 @@ ModifyQuerySupported(Query *queryTree, Query *originalQuery, bool multiShardQuer
NULL, NULL);
}
}
else if (rangeTableEntry->rtekind == RTE_VALUES)
else if (rangeTableEntry->rtekind == RTE_VALUES
#if PG_VERSION_NUM >= 120000
|| rangeTableEntry->rtekind == RTE_RESULT
#endif
)
{
/* do nothing, this type is supported */
}

View File

@ -1013,7 +1013,11 @@ DeferErrorIfUnsupportedTableCombination(Query *queryTree)
* subquery, or immutable function.
*/
if (rangeTableEntry->rtekind == RTE_RELATION ||
rangeTableEntry->rtekind == RTE_SUBQUERY)
rangeTableEntry->rtekind == RTE_SUBQUERY
#if PG_VERSION_NUM >= 120000
|| rangeTableEntry->rtekind == RTE_RESULT
#endif
)
{
/* accepted */
}