[postgis-devel] [PostGIS] #969: [raster] duplicate functions with different named args
PostGIS
trac at osgeo.org
Sat May 21 09:39:12 PDT 2011
#969: [raster] duplicate functions with different named args
----------------------------+-----------------------------------------------
Reporter: robe | Owner: pracine
Type: defect | Status: new
Priority: medium | Milestone: PostGIS 2.0.0
Component: postgis raster | Version: trunk
Keywords: |
----------------------------+-----------------------------------------------
You would only see this error in PostgreSQL 9.0. In PostgreSQL 8.4, it
would just install the last one I think.
So the error I get is:
{{{
psql:share/contrib/postgis-2.0/rtpostgis.sql:1471: ERROR: cannot change
name of input parameter "pixeltype"
HINT: Use DROP FUNCTION first.
}}}
The issue is your ST_MapAlgebra have arguments lists that are not in same
order but have the same type. This is illegal in PostgreSQL 9.0+ because
PostgreSQL 9.0+ supports named arguments
which means I can do ST_MapAlgebra(pixeltype:='8BUI',...) completely out
of order. But since the way your functions are written could result in an
ambiguous function path, your orders need to be the same. Sorry if I'm
not making sense.
--Any rate your issue is here. This is illegal in PostgreSQL 9.0+.
I think you just need to swap the order of pixeltype and nodataexpress
{{{
-- This function can not be STRICT, because nodatavalueexpr can be NULL
(could be just '' though)
-- or pixeltype can not be determined (could be st_bandpixeltype(raster,
band) though)
CREATE OR REPLACE FUNCTION st_mapalgebra(rast raster, expression text,
nodatavalueexpr text, pixeltype text)
RETURNS raster
AS $$ SELECT st_mapalgebra($1, 1, $2, $3, $4) $$
LANGUAGE SQL;
-- This function can not be STRICT, because nodatavalueexpr can be NULL
(could be just '' though)
CREATE OR REPLACE FUNCTION st_mapalgebra(rast raster, expression text,
nodatavalueexpr text)
RETURNS raster
AS $$ SELECT st_mapalgebra($1, 1, $2, $3, NULL) $$
LANGUAGE SQL;
}}}
--
Ticket URL: <http://trac.osgeo.org/postgis/ticket/969>
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