[postgis-devel] [PostGIS] #883: [raster] Make every rtpostgis.sql function immutable strict when possible

PostGIS trac at osgeo.org
Wed Mar 23 12:12:23 PDT 2011


#883: [raster] Make every rtpostgis.sql function immutable strict when possible
----------------------------+-----------------------------------------------
 Reporter:  pracine         |       Owner:  pracine      
     Type:  task            |      Status:  new          
 Priority:  medium          |   Milestone:  PostGIS 2.0.0
Component:  postgis raster  |     Version:  trunk        
 Keywords:                  |  
----------------------------+-----------------------------------------------
Description changed by pracine:

Old description:

> The only exception to this should be when a default parameter can not be
> determined when calling the function.
>
> We must make sure that EVERY functions accepting NULL parameter check for
> null with if (PG_ARGISNULL(0)) in rt_pg.c. STRICT functions do not have
> to do such a check.
>
> Exceptions:
>
> -ST_AddBand(torast raster, fromrast raster, fromband int, toband int)
> because a default value for toband can not be determined before calling
> the function. Could be replaced by "ST_NumBands(rast) + 1" though...
>
> -ST_AddBand(rast raster, index int, pixeltype text, initialvalue float8,
> nodataval float8) because nodataval can be NULL meaning do not set a
> nodata value.
>
> -Every ST_Intersects functions
>
> -Every ST_SetValue functions because NULL means set to nodata
>
> Changed to STRICT:
>
> -ST_MakeEmptyRaster series
>
> -ST_AddBand plpgsql variants
>
> -ST_HasNoBand(rast raster)
>
> -ST_BandIsNodata SQL variants
>
> -ST_BandPath(raster)
>
> -ST_BandPixeltype(raster)
>
> -All ST_Value fucntions
>
> -ST_BandNodataValue(raster)
>
> -ST_BandMetadata SQL variant
>
> -ST_PixelAsPolygon
>
> Still to review:
>
> -ST_MapAlgebra(rast raster, band integer, expression text,
> nodatavalueexpr text, pixeltype text) nodatavalueexpr could be replaced
> by '' in the variants and pixeltype by ST_BandPixelType(rast, band). I
> don't know if this is bad in terms of performance.

New description:

 The only exception to this should be when a default parameter can not be
 determined when calling the function.

 We must make sure that EVERY functions accepting NULL parameter check for
 null with if (PG_ARGISNULL(0)) in rt_pg.c. STRICT functions do not have to
 do such a check.

 Exceptions:

 -ST_AddBand(torast raster, fromrast raster, fromband int, toband int)
 because a default value for toband can not be determined before calling
 the function. Could be replaced by "ST_NumBands(rast) + 1" though...

 -ST_AddBand(rast raster, index int, pixeltype text, initialvalue float8,
 nodataval float8) because nodataval can be NULL meaning do not set a
 nodata value.

 -Every ST_Intersects functions

 -Every ST_SetValue functions because NULL means set to nodata

 Changed to STRICT:

 -ST_MakeEmptyRaster series

 -ST_AddBand plpgsql variants

 -ST_HasNoBand(rast raster)

 -ST_BandIsNodata SQL variants

 -ST_BandPath(raster)

 -ST_BandPixeltype(raster)

 -All ST_Value fucntions

 -ST_BandNodataValue(raster)

 -ST_BandMetadata SQL variant

 -ST_PixelAsPolygon

 Still to review:

 -ST_MapAlgebra(rast raster, band integer, expression text, nodatavalueexpr
 text, pixeltype text) nodatavalueexpr could be replaced by "" in the
 variants and pixeltype by ST_BandPixelType(rast, band). I don't know if
 this is bad in terms of performance.

--

-- 
Ticket URL: <http://trac.osgeo.org/postgis/ticket/883#comment:1>
PostGIS <http://trac.osgeo.org/postgis/>
The PostGIS Trac is used for bug, enhancement & task tracking, a user and developer wiki, and a view into the subversion code repository of PostGIS project.


More information about the postgis-devel mailing list