PostGIS 3.0.6dev-r@@SVN_REVISION@@
Loading...
Searching...
No Matches

◆ PGISDirectFunctionCall2()

Datum PGISDirectFunctionCall2 ( PGFunction  func,
Datum  arg1,
Datum  arg2 
)

A modified version of PostgreSQL's DirectFunctionCall2 which allows NULL results; this is required for aggregates that return NULL.

Definition at line 373 of file lwgeom_accum.c.

374{
375#if POSTGIS_PGSQL_VERSION < 120
376 FunctionCallInfoData fcinfo;
377 Datum result;
378
379 InitFunctionCallInfoData(fcinfo, NULL, 2, InvalidOid, NULL, NULL);
380
381 fcinfo.arg[0] = arg1;
382 fcinfo.arg[1] = arg2;
383 fcinfo.argnull[0] = false;
384 fcinfo.argnull[1] = false;
385
386 result = (*func) (&fcinfo);
387
388 /* Check for null result, returning a "NULL" Datum if indicated */
389 if (fcinfo.isnull)
390 return (Datum) 0;
391
392 return result;
393#else
394 LOCAL_FCINFO(fcinfo, 2);
395 Datum result;
396
397 InitFunctionCallInfoData(*fcinfo, NULL, 2, InvalidOid, NULL, NULL);
398
399 fcinfo->args[0].value = arg1;
400 fcinfo->args[1].value = arg2;
401 fcinfo->args[0].isnull = false;
402 fcinfo->args[1].isnull = false;
403
404 result = (*func)(fcinfo);
405
406 /* Check for null result, returning a "NULL" Datum if indicated */
407 if (fcinfo->isnull)
408 return (Datum)0;
409
410 return result;
411#endif /* POSTGIS_PGSQL_VERSION < 120 */
412}

Referenced by pgis_geometry_clusterwithin_finalfn().

Here is the caller graph for this function: