mirror of https://github.com/citusdata/citus.git
Fix aggregate signature bug (#5854)
parent
0c8aca7c5e
commit
b5448e43e3
|
@ -1454,7 +1454,21 @@ DefineAggregateStmtObjectAddress(Node *node, bool missing_ok)
|
|||
}
|
||||
else
|
||||
{
|
||||
objectWithArgs->objargs = list_make1(makeTypeName("anyelement"));
|
||||
DefElem *defItem = NULL;
|
||||
foreach_ptr(defItem, stmt->definition)
|
||||
{
|
||||
/*
|
||||
* If no explicit args are given, pg includes basetype in the signature.
|
||||
* If the basetype given is a type, like int4, we should include it in the
|
||||
* signature. In that case, defItem->arg would be a TypeName.
|
||||
* If the basetype given is a string, like "ANY", we shouldn't include it.
|
||||
*/
|
||||
if (strcmp(defItem->defname, "basetype") == 0 && IsA(defItem->arg, TypeName))
|
||||
{
|
||||
objectWithArgs->objargs = lappend(objectWithArgs->objargs,
|
||||
defItem->arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FunctionToObjectAddress(OBJECT_AGGREGATE, objectWithArgs, missing_ok);
|
||||
|
|
|
@ -1236,5 +1236,17 @@ SELECT run_command_on_workers($$select aggfnoid from pg_aggregate where aggfnoid
|
|||
(localhost,57638,t,aggregate_support.dependent_agg)
|
||||
(2 rows)
|
||||
|
||||
CREATE AGGREGATE newavg (
|
||||
sfunc = int4_avg_accum, basetype = int4, stype = _int8,
|
||||
finalfunc = int8_avg,
|
||||
initcond1 = '{0,0}'
|
||||
);
|
||||
SELECT run_command_on_workers($$select aggfnoid from pg_aggregate where aggfnoid::text like '%newavg%';$$);
|
||||
run_command_on_workers
|
||||
---------------------------------------------------------------------
|
||||
(localhost,57637,t,aggregate_support.newavg)
|
||||
(localhost,57638,t,aggregate_support.newavg)
|
||||
(2 rows)
|
||||
|
||||
set client_min_messages to error;
|
||||
drop schema aggregate_support cascade;
|
||||
|
|
|
@ -638,5 +638,13 @@ RESET citus.create_object_propagation;
|
|||
|
||||
SELECT run_command_on_workers($$select aggfnoid from pg_aggregate where aggfnoid::text like '%dependent_agg%';$$);
|
||||
|
||||
CREATE AGGREGATE newavg (
|
||||
sfunc = int4_avg_accum, basetype = int4, stype = _int8,
|
||||
finalfunc = int8_avg,
|
||||
initcond1 = '{0,0}'
|
||||
);
|
||||
|
||||
SELECT run_command_on_workers($$select aggfnoid from pg_aggregate where aggfnoid::text like '%newavg%';$$);
|
||||
|
||||
set client_min_messages to error;
|
||||
drop schema aggregate_support cascade;
|
||||
|
|
Loading…
Reference in New Issue