127{
128#ifndef HAVE_LIBPROTOBUF
129 elog(ERROR, "Missing libprotobuf-c");
130 PG_RETURN_NULL();
131#else
132 MemoryContext aggcontext;
134
135
136 postgis_initialize_cache(fcinfo);
137
138 if (!AggCheckCallContext(fcinfo, &aggcontext))
139 elog(ERROR, "%s called in non-aggregate context", __func__);
140 MemoryContextSwitchTo(aggcontext);
141
142 if (PG_ARGISNULL(0)) {
143 ctx = palloc(sizeof(*ctx));
144 ctx->
name =
"default";
145 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
148 if (PG_NARGS() > 3 && !PG_ARGISNULL(3))
149 ctx->
extent = PG_GETARG_INT32(3);
151 if (PG_NARGS() > 4 && !PG_ARGISNULL(4))
153 if (PG_NARGS() > 5 && !PG_ARGISNULL(5))
155 else
158 } else {
160 }
161
162 if (!type_is_rowtype(get_fn_expr_argtype(fcinfo->flinfo, 1)))
163 elog(ERROR, "%s: parameter row cannot be other than a rowtype", __func__);
164 ctx->
row = PG_GETARG_HEAPTUPLEHEADER(1);
165
167 PG_FREE_IF_COPY(ctx->
row, 1);
168 PG_RETURN_POINTER(ctx);
169#endif
170}
void mvt_agg_init_context(mvt_agg_context *ctx)
Initialize aggregation context.
void mvt_agg_transfn(mvt_agg_context *ctx)
Aggregation step.
char * text_to_cstring(const text *textptr)