Ticket #1283 (closed defect: wontfix)

Opened 19 months ago

Last modified 18 months ago

[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: trunk
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

Changed 19 months ago by dustymugs

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

Changed 19 months ago by robe

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.

Changed 19 months ago by robe

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.

Changed 19 months ago by robe

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

Changed 19 months ago by dustymugs

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

Changed 19 months ago by robe

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;

Changed 19 months ago by dustymugs

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

Changed 19 months ago by robe

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.

Changed 19 months ago by dustymugs

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

Changed 19 months ago by robe

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.

Changed 19 months ago by dustymugs

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

Changed 19 months ago by dustymugs

The problem also exists in pgAdmin 1.12.2 in linux.

Changed 19 months ago by dustymugs

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';

Changed 18 months ago by dustymugs

  • priority changed from blocker to low
  • summary changed from ST_MapAlgebraFct 2 band version function proto looks wrong to [raster] ST_MapAlgebraFct 2 band version function proto looks wrong

Changed 18 months ago by dustymugs

  • status changed from new to closed
  • resolution set to wontfix

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

Changed 18 months ago by robe

okay I've reported to pgAdmin support

Note: See TracTickets for help on using tickets.