46 MemoryContext aggcontext, oldcontext;
47 char *geom_name = NULL;
48 bool create_index =
false;
51 POSTGIS_DEBUG(2,
"calling pgis_asflatgeobuf_transfn");
54 postgis_initialize_cache();
56 if (!AggCheckCallContext(fcinfo, &aggcontext))
57 elog(ERROR,
"pgis_asflatgeobuf_transfn: called in non-aggregate context");
58 oldcontext = MemoryContextSwitchTo(aggcontext);
60 if (PG_ARGISNULL(0)) {
61 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
62 create_index = PG_GETARG_BOOL(2);
63 if (PG_NARGS() > 3 && !PG_ARGISNULL(3))
64 geom_name = text_to_cstring(PG_GETARG_TEXT_P(3));
70 if (!type_is_rowtype(get_fn_expr_argtype(fcinfo->flinfo, 1)))
71 elog(ERROR,
"pgis_asflatgeobuf_transfn: parameter row cannot be other than a rowtype");
72 ctx->
row = PG_GETARG_HEAPTUPLEHEADER(1);
75 MemoryContextSwitchTo(oldcontext);
76 PG_RETURN_POINTER(ctx);
struct flatgeobuf_agg_ctx * flatgeobuf_agg_ctx_init(const char *geom_name, const bool create_index)
Initialize aggregation context.
void flatgeobuf_agg_transfn(struct flatgeobuf_agg_ctx *ctx)
Aggregation step.