[postgis-devel] What to return when refering to an invalid band number

Pierre Racine Pierre.Racine at sbf.ulaval.ca
Fri Mar 25 08:18:33 PDT 2011


I also tend to disagree...

Regina do you see cases when it is preferable to return just a warning and a null instead of an error? Is there any rule about that in PostGIS?

I see two cases where just returning a warning is more user friendly:

-You are making a query that takes hours and, for a million of possible reasons, only one row or a few rows store data having a smaller range than the provided index. You don't want your query to stop with an error. You just want a warning and a null result helping you to find the black sheep. You might find out that the black sheep is normal and you are happy that you got all the other results.

Think about this kind of query as a batch program. What a frustration when your 4 hours batch stop with an error instead of just a log of something wrong and the rest totally normal... You have to launch it again taking care of this spefific case even if it might be normal.

-Right now we return just a warning and a null when the x and y of ST_Value(rast, band, x, y) are out of range. I don't remember the exact cases but I know in many situations this much more convenient.

We must not thing about SQL queries the same way we thing about C or Python functions. The fact that SQL queries apply to many different data, might takes hours and are often done by humans makes them very different. It seems to me...

Pierre

>-----Original Message-----
>From: Sandro Santilli [mailto:strk at keybit.net]
>Sent: 25 mars 2011 11:15
>To: PostGIS Development Discussion
>Cc: Pierre Racine
>Subject: Re: [postgis-devel] What to return when refering to an invalid band number
>
>On Fri, Mar 25, 2011 at 12:02:57PM +0100, Jorge Arévalo wrote:
>> On Fri, Mar 25, 2011 at 12:31 AM, Mateusz Loskot <mateusz at loskot.net> wrote:
>>
>>> IMHO, index out of range is an error condition, an exception, and as such it
>>> should result with error.
>>
>> +1 for that.
>
>I tend to disagree.
>Out of range values are unknown, and as such should be threated.
>
>For example:
>
>=# select substring('test' from 10 for 1);
> substring
>-----------
>
>(1 row)
>
>--strk;
>
>  ()   Free GIS & Flash consultant/developer
>  /\   http://strk.keybit.net/services.html



More information about the postgis-devel mailing list