Oid ufc_noid;
FmgrInfo ufl_info;
FunctionCallInfoData ufc_info;
- int ufc_nullcount;
} rtpg_nmapalgebra_callback_arg;
typedef struct rtpg_nmapalgebra_arg_t *rtpg_nmapalgebra_arg;
arg->mask = NULL;
arg->callback.ufc_noid = InvalidOid;
- arg->callback.ufc_nullcount = 0;
return arg;
}
callback->ufc_info.arg[0] = PointerGetDatum(mdValues);
callback->ufc_info.arg[1] = PointerGetDatum(mdPos);
- /* function is strict and null parameter is passed */
- /* http://archives.postgresql.org/pgsql-general/2011-11/msg00424.php */
- if (callback->ufl_info.fn_strict && callback->ufc_nullcount) {
- *nodata = 1;
-
- pfree(mdValues);
- pfree(mdPos);
-
- return 1;
- }
-
/* call user callback function */
datum = FunctionCallInvoke(&(callback->ufc_info));
pfree(mdValues);
else {
arg->callback.ufc_info.arg[2] = (Datum) NULL;
arg->callback.ufc_info.argnull[2] = TRUE;
- arg->callback.ufc_nullcount++;
+ 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");
+ }
}
}
else {
(ST_BandMetadata(rast, 1))
FROM foo;
+-- Test that you can't pass a strict callback and no user argument
+-- Se http://trac.osgeo.org/postgis/ticket/2803
+CREATE FUNCTION strict_cb(float8[][][], int[][], text[])
+returns float8 AS $$ select 0::float8; $$ language 'sql' immutable strict;
+SELECT ST_MapAlgebra( t1.rast, 2,
+ 'strict_cb(float8[][][], int[][], text[])'::regprocedure)
+ FROM raster_nmapalgebra_in t1;
+DROP FUNCTION strict_cb(float8[][][],int[][],text[]);
+
DROP FUNCTION IF EXISTS raster_nmapalgebra_test(double precision[], int[], text[]);
DROP TABLE IF EXISTS raster_nmapalgebra_in;
+
NOTICE: pos = [0:1][1:2]={{2,2},{2,2}}
NOTICE: userargs = <NULL>
30|(0,0,2,2,1,-1,0,0,0,1)|(8BUI,0,f,)
+NOTICE: First argument (nband) of rastbandarg at index 0 is NULL. Assuming NULL raster
+NOTICE: All input rasters are NULL. Returning NULL
+NOTICE: All input rasters do not have bands at indicated indexes. Returning empty raster
+NOTICE: All input rasters do not have bands at indicated indexes. Returning empty raster
+ERROR: RASTER_nMapAlgebra: strict callback requires user argument