45{
46 MemoryContext aggcontext, oldcontext;
47 char *geom_name = NULL;
50
51 POSTGIS_DEBUG(2, "calling pgis_asflatgeobuf_transfn");
52
53
54 postgis_initialize_cache();
55
56 if (!AggCheckCallContext(fcinfo, &aggcontext))
57 elog(ERROR, "pgis_asflatgeobuf_transfn: called in non-aggregate context");
58 oldcontext = MemoryContextSwitchTo(aggcontext);
59
60 if (PG_ARGISNULL(0)) {
61 if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
63 if (PG_NARGS() > 3 && !PG_ARGISNULL(3))
64 geom_name = text_to_cstring(PG_GETARG_TEXT_P(3));
66 } else {
68 }
69
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);
73
75 MemoryContextSwitchTo(oldcontext);
76 PG_RETURN_POINTER(ctx);
77}
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.
static int create_index(const char *schema, const char *table, const char *column, const char *tablespace, STRINGBUFFER *buffer)