40{
41 MemoryContext aggcontext, old;
43 Datum argType;
45
46
47 argType = get_fn_expr_argtype(fcinfo->flinfo, 1);
48 if (argType == InvalidOid)
49 ereport(ERROR, (
50 errcode(ERRCODE_INVALID_PARAMETER_VALUE),
51 errmsg("%s: could not determine input data type", __func__)));
52
53
55
56
57 if (PG_ARGISNULL(0)) {
58 old = MemoryContextSwitchTo(aggcontext);
60 MemoryContextSwitchTo(old);
61 }
62 else
63 {
65 }
66
67
68 if (!PG_ARGISNULL(1))
69 gser = PG_GETARG_GSERIALIZED_P(1);
70
71
72 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
73 {
74 double gridSize = PG_GETARG_FLOAT8(2);
75 if (gridSize > 0)
77 }
78
79
80 if (gser) {
81 old = MemoryContextSwitchTo(aggcontext);
83 MemoryContextSwitchTo(old);
84 }
85
86 PG_RETURN_POINTER(state);
87}
static UnionState * state_create(void)
#define GetAggContext(aggcontext)
static void state_append(UnionState *state, const GSERIALIZED *gser)