PostGIS  3.4.0dev-r@@SVN_REVISION@@

◆ pgis_geometry_union_parallel_transfn()

Datum pgis_geometry_union_parallel_transfn ( PG_FUNCTION_ARGS  )

Definition at line 39 of file lwgeom_union.c.

40 {
41  MemoryContext aggcontext, old;
42  UnionState *state;
43  Datum argType;
44  GSERIALIZED *gser = NULL;
45 
46  /* Check argument type */
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  /* Get memory context */
54  GetAggContext(&aggcontext);
55 
56  /* Get state */
57  if (PG_ARGISNULL(0)) {
58  old = MemoryContextSwitchTo(aggcontext);
59  state = state_create();
60  MemoryContextSwitchTo(old);
61  }
62  else
63  {
64  state = (UnionState*) PG_GETARG_POINTER(0);
65  }
66 
67  /* Get value */
68  if (!PG_ARGISNULL(1))
69  gser = PG_GETARG_GSERIALIZED_P(1);
70 
71  /* Get grid size */
72  if (PG_NARGS() > 2 && !PG_ARGISNULL(2))
73  {
74  double gridSize = PG_GETARG_FLOAT8(2);
75  if (gridSize > 0)
76  state->gridSize = gridSize;
77  }
78 
79  /* Copy serialized geometry into state */
80  if (gser) {
81  old = MemoryContextSwitchTo(aggcontext);
82  state_append(state, gser);
83  MemoryContextSwitchTo(old);
84  }
85 
86  PG_RETURN_POINTER(state);
87 }
static UnionState * state_create(void)
Definition: lwgeom_union.c:169
#define GetAggContext(aggcontext)
Definition: lwgeom_union.c:16
static void state_append(UnionState *state, const GSERIALIZED *gser)
Definition: lwgeom_union.c:179
float8 gridSize
Definition: lwgeom_union.h:9

References GetAggContext, UnionState::gridSize, state_append(), and state_create().

Here is the call graph for this function: