Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1283 closed defect (wontfix)

[raster] ST_MapAlgebraFct 2 band version function proto looks wrong

Reported by: robe Owned by: pracine
Priority: low Milestone: PostGIS 2.0.0
Component: raster Version: master
Keywords: Cc:

Description

I was starting to put together documentation for this when I realized — this does not make sense:

CREATE OR REPLACE FUNCTION st_mapalgebrafct(IN rast1 raster, IN band1 integer, IN rast2 raster, IN band2 integer, IN userfunction regprocedure DEFAULT NULL::text, IN pixeltype text DEFAULT 'INTERSECTION'::text, IN extenttype text DEFAULT NULL::text[], VARIADIC userargs text[])
  RETURNS raster AS
'$libdir/rtpostgis-2.0', 'RASTER_mapAlgebra2'
  LANGUAGE c STABLE
  COST 1;
ALTER FUNCTION st_mapalgebrafct(raster, integer, raster, integer, regprocedure, text, text, text[])

Why is default for pixeltype INTERSECTION, should it be like 8BUI or something?

The defaults don't even seem to match the signature

Change History (16)

comment:1 by Bborie Park, 12 years ago

Uhm. I don't see what you're seeing. Looking at rtpostgis.sql.in.c, everything looks correct.

comment:2 by robe, 12 years ago

hmm that's weird. Let me look again. That is what I got in my system when I installed scanning via PgAdmin III. I didn't bother looking at what rtpostgis.sql.in.c was showing.

comment:3 by robe, 12 years ago

Okay I think we have a small little problem here, which may or may not related. you are right I'm not seeing this in the rtpostgis.sql.

But how would one distinguish between this:

CREATE OR REPLACE FUNCTION st_mapalgebrafct(
	rast1 raster, band1 integer,
	rast2 raster, band2 integer,
	userfunction regprocedure,
	pixeltype text DEFAULT NULL, extenttype text DEFAULT 'INTERSECTION',
	VARIADIC userargs text[] DEFAULT NULL
)

and

CREATE OR REPLACE FUNCTION st_mapalgebrafct(
	rast1 raster, band1 integer,
	rast2 raster, band2 integer,
	userfunction regprocedure,
	VARIADIC userargs text[] DEFAULT NULL
)

After all in the first - those extra texts could easily fall into VARIADIC loop since they are optional. I think your first one the arguments should not have defaults.

comment:4 by robe, 12 years ago

though I guess that still wouldn't fix the issue. Hmm. Perhaps if you have the pixeltype etc. come before the userfunction.

comment:5 by Bborie Park, 12 years ago

That second signature does NOT exist. I have no idea where you're getting that. If you check rtpostgis.sql.in.c, there is no such function like the second.

http://trac.osgeo.org/postgis/browser/trunk/raster/rt_pg/rtpostgis.sql.in.c

comment:6 by robe, 12 years ago

Sorry that was a copy and paste mistake. I meant: These two

http://trac.osgeo.org/postgis/browser/trunk/raster/rt_pg/rtpostgis.sql.in.c#L1701

CREATE OR REPLACE FUNCTION st_mapalgebrafct(
	rast1 raster,
	rast2 raster,
	userfunction regprocedure,
	pixeltype text DEFAULT NULL, extenttype text DEFAULT 'INTERSECTION',
	VARIADIC userargs text[] DEFAULT NULL
)
	RETURNS raster
	AS $$ SELECT st_mapalgebrafct($1, 1, $2, 1, $3, $4, $5, VARIADIC $6) $$
	LANGUAGE 'SQL' STABLE;

http://trac.osgeo.org/postgis/browser/trunk/raster/rt_pg/rtpostgis.sql.in.c#L1712

CREATE OR REPLACE FUNCTION st_mapalgebrafct(
	rast1 raster,
	rast2 raster,
	userfunction regprocedure,
	VARIADIC userargs text[]
)
	RETURNS raster
	AS $$ SELECT st_mapalgebrafct($1, 1, $2, 1, $3, NULL, 'INTERSECTION', VARIADIC $4) $$
	LANGUAGE 'SQL' STABLE;

comment:7 by Bborie Park, 12 years ago

I see what you're talking about. I'm going to remove the third variant. It's a nice shorthand but I'd rather have the defaults in the second variant.

Third variant removed in r8143

comment:8 by robe, 12 years ago

I wonder if this is a pgAdmin bug. When I install in 9.1:

CREATE OR REPLACE FUNCTION st_mapalgebrafct(
	rast1 raster,
	rast2 raster,
	userfunction regprocedure,
	pixeltype text DEFAULT NULL, extenttype text DEFAULT 'INTERSECTION',
	VARIADIC userargs text[] DEFAULT NULL
)
	RETURNS raster
	AS $$ SELECT st_mapalgebrafct($1, 1, $2, 1, $3, $4, $5, VARIADIC $6) $$
	LANGUAGE 'SQL' STABLE;

and I look at what got installed in PgAdmin — it shows me:

CREATE OR REPLACE FUNCTION st_mapalgebrafct(IN rast1 raster, IN rast2 raster, IN userfunction regprocedure DEFAULT NULL::text, IN pixeltype text DEFAULT 'INTERSECTION'::text, IN extenttype text DEFAULT NULL::text[], VARIADIC userargs text[])
  RETURNS raster AS
' SELECT st_mapalgebrafct($1, 1, $2, 1, $3, $4, $5, VARIADIC $6) '
  LANGUAGE sql STABLE
  COST 100;

I'll experiment and see.

comment:9 by Bborie Park, 12 years ago

I'd call that a bug. Especially if psql shows the schema correctly.

comment:10 by robe, 12 years ago

Yah I think it is in pgAdmin because I'm not getting any weird errors if I don't pass in those extra args. I'll test some more before I complain to the pgAdmin folks and then I'll close this one out.

comment:11 by Bborie Park, 12 years ago

I'm getting the same issue with pgAdmin 1.14.0 in linux.

comment:12 by Bborie Park, 12 years ago

The problem also exists in pgAdmin 1.12.2 in linux.

comment:13 by Bborie Park, 12 years ago

Definitely a pgAdmin bug. Test case is:

CREATE OR REPLACE FUNCTION test_regprocedure(
	func regprocedure,
	VARIADIC junk text[] DEFAULT NULL
)
RETURNS text AS $$
BEGIN
	RETURN NULL;
END;
$$ LANGUAGE 'plpgsql';

comment:14 by Bborie Park, 12 years ago

Priority: blockerlow
Summary: ST_MapAlgebraFct 2 band version function proto looks wrong[raster] ST_MapAlgebraFct 2 band version function proto looks wrong

comment:15 by Bborie Park, 12 years ago

Resolution: wontfix
Status: newclosed

This is a pgAdmin issue. If not, please reopen.

comment:16 by robe, 12 years ago

okay I've reported to pgAdmin support

Note: See TracTickets for help on using tickets.