[postgis-devel] Postgis documentation clarification request.

Mateusz Loskot mateusz at loskot.net
Fri Feb 23 11:41:15 PST 2018


On 23 February 2018 at 19:42, Birkett, Scott <scott.birkett at pioneer.com> wrote:
>
> Please consider adding documentation to explain why the following SQL
> statement returns true.
> [...]
> ( ST_AsTiff(raster, ARRAY[1,2]) = ST_AsTiff(raster, ARRAY[3]) ) appears to
> evaluate to true because any raster band selection on a band that doesn’t
> exists (ARRAY[3] in this example) returns ALL the raster bands.
> [...]
> I am not asking for ST_Band or ST_AsTiff to change functionality, but if the
> documentation https://postgis.net/docs/RT_ST_AsTIFF.html made it apparent
> that parameter integer[] nbands fetches you ALL the bands when band request
> are made that don’t exists might help people of the future.

Your discovery is correct.
If any of band indices are out of the range of number of available bands,
then complete original raster is returned.
BTW, this is derivative of how ST_Band behaves.

Would changing the docs statement

"If no band is specified, then will try to use all bands."

to read something like:

"If no band is specified or any of specified bands does not exist in
the raster, then will try to use all bands."

?

Best regards,
-- 
Mateusz Loskot, http://mateusz.loskot.net


More information about the postgis-devel mailing list