PostGIS  2.5.7dev-r@@SVN_REVISION@@

◆ 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 430 of file lwgeom_accum.c.

431 {
432 #if POSTGIS_PGSQL_VERSION < 120
433  FunctionCallInfoData fcinfo;
434  Datum result;
435 
436  InitFunctionCallInfoData(fcinfo, NULL, 2, InvalidOid, NULL, NULL);
437 
438  fcinfo.arg[0] = arg1;
439  fcinfo.arg[1] = arg2;
440  fcinfo.argnull[0] = false;
441  fcinfo.argnull[1] = false;
442 
443  result = (*func) (&fcinfo);
444 
445  /* Check for null result, returning a "NULL" Datum if indicated */
446  if (fcinfo.isnull)
447  return (Datum) 0;
448 
449  return result;
450 #else
451  LOCAL_FCINFO(fcinfo, 2);
452  Datum result;
453 
454  InitFunctionCallInfoData(*fcinfo, NULL, 2, InvalidOid, NULL, NULL);
455 
456  fcinfo->args[0].value = arg1;
457  fcinfo->args[1].value = arg2;
458  fcinfo->args[0].isnull = false;
459  fcinfo->args[1].isnull = false;
460 
461  result = (*func)(fcinfo);
462 
463  /* Check for null result, returning a "NULL" Datum if indicated */
464  if (fcinfo->isnull)
465  return (Datum)0;
466 
467  return result;
468 #endif /* POSTGIS_PGSQL_VERSION < 120 */
469 }

Referenced by pgis_geometry_clusterwithin_finalfn().

Here is the caller graph for this function: