Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#2802 closed enhancement (fixed)

[raster] ST_MapAlgebra checks callbacks parameters but not return type

Reported by: strk Owned by: Bborie Park
Priority: medium Milestone: PostGIS 2.1.4
Component: raster Version: 2.1.x
Keywords: history Cc:


I tried using a callback only accepting 2 arguments and ST_MapAlgebra complained about that. But it did not complain about the callback returning an integer rather than a float8.

As the C code fetches the return value in binary form, I guess returning anything but "float8" would just not work, silently.

If this is confirmed, it would be nice for ST_MapAlgebra to also check the return type of the provided callback.

Change History (6)

comment:1 Changed 5 years ago by Bborie Park

Status: newassigned

comment:2 Changed 5 years ago by Bborie Park

The check for return type will throw an Exception if not a double precision.

comment:3 Changed 5 years ago by strk

I didnt' get an exception when returning integer. Looking at the code the return type check only prevents your callback from returning a SET.

comment:4 Changed 5 years ago by Bborie Park

I'll probably fix this as I fix #2803.

comment:5 Changed 5 years ago by Bborie Park

Keywords: history added
Milestone: PostGIS 2.1.4
Resolution: fixed
Status: assignedclosed
Version: trunk2.1.x

Fixed for -trunk in r12744. Fixed for -2.1 in r12745.

comment:6 Changed 5 years ago by strk

Great, thanks!

nitpicking: the error printed on returning a SET still says you need to return a "double precision", while if you return a "text" (for example) the error tells you that also int,smallint and float4 are accepted.

Note: See TracTickets for help on using tickets.