From 44bae26c9b13ee18b9d04dc2321bbf04e21866d1 Mon Sep 17 00:00:00 2001 From: Bborie Park Date: Sun, 6 Jul 2014 15:27:32 +0000 Subject: [PATCH] use empty TEXT array for userargs when no user args and STRICT callback function git-svn-id: http://svn.osgeo.org/postgis/trunk@12734 b70326c6-7e19-0410-871a-916f4a2858ee --- raster/rt_pg/rtpg_mapalgebra.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/raster/rt_pg/rtpg_mapalgebra.c b/raster/rt_pg/rtpg_mapalgebra.c index 539840303..2cfbf9c8d 100644 --- a/raster/rt_pg/rtpg_mapalgebra.c +++ b/raster/rt_pg/rtpg_mapalgebra.c @@ -798,13 +798,18 @@ Datum RASTER_nMapAlgebra(PG_FUNCTION_ARGS) if (!PG_ARGISNULL(9)) arg->callback.ufc_info.arg[2] = PG_GETARG_DATUM(9); else { - arg->callback.ufc_info.arg[2] = (Datum) NULL; - arg->callback.ufc_info.argnull[2] = TRUE; - if ( arg->callback.ufl_info.fn_strict ) { - /* function is strict and null parameter is passed */ - /* http://archives.postgresql.org/pgsql-general/2011-11/msg00424.php */ - elog(ERROR, "RASTER_nMapAlgebra: strict callback requires user argument"); + if (arg->callback.ufl_info.fn_strict) { + /* build and assign an empty TEXT array */ + /* TODO: manually free the empty array? */ + arg->callback.ufc_info.arg[2] = PointerGetDatum( + construct_empty_array(TEXTOID) + ); + arg->callback.ufc_info.argnull[2] = FALSE; } + else { + arg->callback.ufc_info.arg[2] = (Datum) NULL; + arg->callback.ufc_info.argnull[2] = TRUE; + } } } else { -- 2.40.0