mark_aggregate_for_distributed_execution: EnsureSuperUser for AGGREGATION_STRATEGY_COMBINE

fix_120_custom_aggregates_distribute_multiarg
Philip Dubé 2019-10-21 19:35:19 +00:00
parent 8fe885b457
commit 9abe31e34d
1 changed files with 9 additions and 2 deletions

View File

@ -249,8 +249,6 @@ mark_aggregate_for_distributed_execution(PG_FUNCTION_ARGS)
"followed by a list of parameters in parantheses"))); "followed by a list of parameters in parantheses")));
} }
EnsureFunctionOwner(funcOid);
if (!PG_ARGISNULL(1)) if (!PG_ARGISNULL(1))
{ {
char *strategyParam = TextDatumGetCString(PG_GETARG_TEXT_P(1)); char *strategyParam = TextDatumGetCString(PG_GETARG_TEXT_P(1));
@ -274,6 +272,15 @@ mark_aggregate_for_distributed_execution(PG_FUNCTION_ARGS)
"mark_aggregate_for_distributed_execution expects a strategy that is one of: 'none', 'combine', 'commute'"); "mark_aggregate_for_distributed_execution expects a strategy that is one of: 'none', 'combine', 'commute'");
} }
if (aggregationStrategy == AGGREGATION_STRATEGY_COMBINE)
{
EnsureSuperUser();
}
else
{
EnsureFunctionOwner(funcOid);
}
if (aggregationStrategy == AGGREGATION_STRATEGY_COMBINE) if (aggregationStrategy == AGGREGATION_STRATEGY_COMBINE)
{ {
proctup = SearchSysCache1(PROCOID, funcOid); proctup = SearchSysCache1(PROCOID, funcOid);