PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ pgis_asflatgeobuf_transfn()

Datum pgis_asflatgeobuf_transfn ( PG_FUNCTION_ARGS  )

Definition at line 44 of file lwgeom_out_flatgeobuf.c.

45 {
46  MemoryContext aggcontext, oldcontext;
47  char *geom_name = NULL;
48  bool create_index = false;
49  flatgeobuf_agg_ctx *ctx;
50 
51  POSTGIS_DEBUG(2, "calling pgis_asflatgeobuf_transfn");
52 
53  /* We need to initialize the internal cache to access it later via postgis_oid() */
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))
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));
65  ctx = flatgeobuf_agg_ctx_init(geom_name, create_index);
66  } else {
67  ctx = (flatgeobuf_agg_ctx *) PG_GETARG_POINTER(0);
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.
Definition: flatgeobuf.c:503
void flatgeobuf_agg_transfn(struct flatgeobuf_agg_ctx *ctx)
Aggregation step.
Definition: flatgeobuf.c:527
HeapTupleHeader row
Definition: flatgeobuf.h:52

References flatgeobuf_agg_ctx_init(), flatgeobuf_agg_transfn(), and flatgeobuf_agg_ctx::row.

Here is the call graph for this function: