29 #include "access/tupmacs.h"
30 #include "utils/datum.h"
31 #include "utils/array.h"
32 #include "utils/lsyscache.h"
34 #include "../postgis_config.h"
38 #include "lwgeom_pg.h"
39 #include "lwgeom_transform.h"
66 ereport(ERROR,(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
67 errmsg(
"function %s not implemented", __func__)));
68 PG_RETURN_POINTER(NULL);
74 ereport(ERROR,(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
75 errmsg(
"function %s not implemented", __func__)));
76 PG_RETURN_POINTER(NULL);
124 Oid arg1_typeid = get_fn_expr_argtype(fcinfo->flinfo, 1);
125 MemoryContext aggcontext;
126 ArrayBuildState *state;
130 if (arg1_typeid == InvalidOid)
132 (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
133 errmsg(
"could not determine input data type")));
135 if ( ! AggCheckCallContext(fcinfo, &aggcontext) )
138 elog(ERROR,
"%s called in non-aggregate context", __func__);
142 if ( PG_ARGISNULL(0) )
144 MemoryContext old = MemoryContextSwitchTo(aggcontext);
147 p->
data = (Datum) NULL;
151 Datum argument = PG_GETARG_DATUM(2);
152 Oid dataOid = get_fn_expr_argtype(fcinfo->flinfo, 2);
154 p->
data = datumCopy(argument, get_typbyval(dataOid), get_typlen(dataOid));
157 MemoryContextSwitchTo(old);
161 p = (
pgis_abs*) PG_GETARG_POINTER(0);
164 elem = PG_ARGISNULL(1) ? (Datum) 0 : PG_GETARG_DATUM(1);
165 state = accumArrayResult(state,
172 PG_RETURN_POINTER(p);
188 ArrayBuildState *state;
192 Assert(fcinfo->context &&
193 (IsA(fcinfo->context, AggState) ||
194 IsA(fcinfo->context, WindowAggState))
198 dims[0] = state->nelems;
200 result = makeMdArrayResult(state, 1, dims, lbs, mctx,
false);
217 p = (
pgis_abs*) PG_GETARG_POINTER(0);
221 PG_RETURN_DATUM(result);
235 Datum geometry_array = 0;
240 p = (
pgis_abs*) PG_GETARG_POINTER(0);
247 PG_RETURN_DATUM(result);
260 Datum geometry_array = 0;
265 p = (
pgis_abs*) PG_GETARG_POINTER(0);
272 PG_RETURN_DATUM(result);
286 Datum geometry_array = 0;
291 p = (
pgis_abs*) PG_GETARG_POINTER(0);
298 PG_RETURN_DATUM(result);
311 Datum geometry_array = 0;
316 p = (
pgis_abs*) PG_GETARG_POINTER(0);
323 PG_RETURN_DATUM(result);
336 Datum geometry_array = 0;
341 p = (
pgis_abs*) PG_GETARG_POINTER(0);
347 PG_RETURN_DATUM(result);
360 Datum geometry_array = 0;
365 p = (
pgis_abs*) PG_GETARG_POINTER(0);
369 elog(ERROR,
"Tolerance not defined");
378 PG_RETURN_DATUM(result);
388 #if POSTGIS_PGSQL_VERSION < 120
389 FunctionCallInfoData fcinfo;
393 InitFunctionCallInfoData(fcinfo, NULL, 1, InvalidOid, NULL, NULL);
396 fcinfo.arg[0] = arg1;
397 fcinfo.argnull[0] =
false;
399 result = (*func) (&fcinfo);
407 LOCAL_FCINFO(fcinfo, 1);
410 InitFunctionCallInfoData(*fcinfo, NULL, 1, InvalidOid, NULL, NULL);
412 fcinfo->args[0].value = arg1;
413 fcinfo->args[0].isnull =
false;
415 result = (*func)(fcinfo);
432 #if POSTGIS_PGSQL_VERSION < 120
433 FunctionCallInfoData fcinfo;
436 InitFunctionCallInfoData(fcinfo, NULL, 2, InvalidOid, NULL, NULL);
438 fcinfo.arg[0] = arg1;
439 fcinfo.arg[1] = arg2;
440 fcinfo.argnull[0] =
false;
441 fcinfo.argnull[1] =
false;
443 result = (*func) (&fcinfo);
451 LOCAL_FCINFO(fcinfo, 2);
454 InitFunctionCallInfoData(*fcinfo, NULL, 2, InvalidOid, NULL, NULL);
456 fcinfo->args[0].value = arg1;
457 fcinfo->args[1].value = arg2;
458 fcinfo->args[0].isnull =
false;
459 fcinfo->args[1].isnull =
false;
461 result = (*func)(fcinfo);
This library is the generic geometry handling section of PostGIS.
Datum polygonize_garray(PG_FUNCTION_ARGS)
Datum pgis_abs_in(PG_FUNCTION_ARGS)
Putting pgis_abs back for ABI compatibility with 2.4 and below TODO: Drop when 3.0 rolls around.
Datum pgis_accum_finalfn(pgis_abs *p, MemoryContext mctx, FunctionCallInfo fcinfo)
Datum pgis_geometry_makeline_finalfn(PG_FUNCTION_ARGS)
Datum pgis_geometry_polygonize_finalfn(PG_FUNCTION_ARGS)
Datum cluster_within_distance_garray(PG_FUNCTION_ARGS)
Datum pgis_geometry_accum_finalfn(PG_FUNCTION_ARGS)
Datum pgis_geometry_collect_finalfn(PG_FUNCTION_ARGS)
Datum pgis_abs_out(PG_FUNCTION_ARGS)
Datum PGISDirectFunctionCall1(PGFunction func, Datum arg1)
A modified version of PostgreSQL's DirectFunctionCall1 which allows NULL results; this is required fo...
Datum pgis_geometry_clusterintersecting_finalfn(PG_FUNCTION_ARGS)
Datum PGISDirectFunctionCall2(PGFunction func, Datum arg1, Datum arg2)
A modified version of PostgreSQL's DirectFunctionCall2 which allows NULL results; this is required fo...
Datum LWGEOM_collect_garray(PG_FUNCTION_ARGS)
Datum pgis_geometry_clusterwithin_finalfn(PG_FUNCTION_ARGS)
Datum clusterintersecting_garray(PG_FUNCTION_ARGS)
Datum LWGEOM_makeline_garray(PG_FUNCTION_ARGS)
Datum pgis_geometry_union_finalfn(PG_FUNCTION_ARGS)
Datum pgis_geometry_accum_transfn(PG_FUNCTION_ARGS)
Datum pgis_union_geometry_array(PG_FUNCTION_ARGS)
PG_FUNCTION_INFO_V1(pgis_abs_in)
Putting back pgis_* for ABI compatibility to smooth pg_upgrade TODO: Drop when 3.0 rolls around.
To pass the internal ArrayBuildState pointer between the transfn and finalfn we need to wrap it into ...