ReleaseSysCache in logical_optimizer

fix_120_custom_aggregates_distribute_multiarg
Philip Dubé 2019-06-17 03:34:34 -07:00
parent a82fa8831c
commit 186f632f88
1 changed files with 10 additions and 10 deletions

View File

@ -1510,9 +1510,9 @@ MasterAggregateExpression(Aggref *originalAggregate,
AggClauseCosts aggregateCosts;
HeapTuple aggTuple;
Form_pg_aggregate aggform;
Oid combinefn;
Oid serialfn = InvalidOid;
Oid deserialfn = InvalidOid;
Oid combine;
Oid serial = InvalidOid;
Oid deserial = InvalidOid;
aggTuple = SearchSysCache1(AGGFNOID,
ObjectIdGetDatum(originalAggregate->aggfnoid));
@ -1520,15 +1520,15 @@ MasterAggregateExpression(Aggref *originalAggregate,
elog(ERROR, "cache lookup failed for aggregate %u",
originalAggregate->aggfnoid);
aggform = (Form_pg_aggregate) GETSTRUCT(aggTuple);
/* planner recorded transition state type in the Aggref itself */
combinefn = aggform->aggcombinefn;
if (combinefn != InvalidOid) {
if (originalAggregate->aggtranstype == INTERNALOID) {
serialfn = aggform->aggserialfn;
deserialfn = aggform->aggdeserialfn;
combine = aggform->aggcombinefn;
if (IsValidOid(combine) && originalAggregate->aggtranstype == INTERNALOID) {
serial = aggform->aggserialfn;
deserial = aggform->aggdeserialfn;
}
ReleaseSysCache(aggTuple);
if (IsValidOid(combine)) {
} else if (aggregateType == AGGREGATE_COUNT && originalAggregate->aggdistinct &&
CountDistinctErrorRate == DISABLE_DISTINCT_APPROXIMATION &&
walkerContext->pullDistinctColumns)