static void rtpg_dumpvalues_arg_destroy(rtpg_dumpvalues_arg arg) {
int i = 0;
- if (arg->numbands) {
+ if (arg->numbands > 0) {
if (arg->nbands != NULL)
pfree(arg->nbands);
- for (i = 0; i < arg->numbands; i++) {
- if (arg->values[i] != NULL)
- pfree(arg->values[i]);
+ if (arg->values != NULL) {
+ for (i = 0; i < arg->numbands; i++) {
- if (arg->nodata[i] != NULL)
- pfree(arg->nodata[i]);
- }
+ if (arg->values[i] != NULL)
+ pfree(arg->values[i]);
+
+ if (arg->nodata[i] != NULL)
+ pfree(arg->nodata[i]);
+ }
- if (arg->values != NULL)
pfree(arg->values);
+ }
+
if (arg->nodata != NULL)
pfree(arg->nodata);
}
}
}
+ /* no bands specified, return all bands */
else {
arg1->numbands = numbands;
arg1->nbands = palloc(sizeof(int) * arg1->numbands);
DROP TABLE IF EXISTS raster_dumpvalues;
-SELECT (ST_DumpValues(ST_AddBand(ST_MakeEmptyRaster(0, 0, 0, 0, 1), ARRAY[ROW(NULL, '8BUI', 255, 0),ROW(NULL, '16BUI', 1, 2)]::addbandarg[]))).*
+SELECT (ST_DumpValues(ST_AddBand(ST_MakeEmptyRaster(0, 0, 0, 0, 1), ARRAY[ROW(NULL, '8BUI', 255, 0),ROW(NULL, '16BUI', 1, 2)]::addbandarg[]))).*;
+
+
+-- #3086
+DROP TABLE IF EXISTS raster_tile;
+CREATE TABLE raster_tile AS
+ WITH foo AS (
+ SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 0, 0, 1, -1, 0, 0, 0), 1, '8BUI', 1, 0), 2, '8BUI', 10, 0) AS rast UNION ALL
+ SELECT ST_AddBand(ST_AddBand(ST_MakeEmptyRaster(3, 3, 3, 0, 1, -1, 0, 0, 0), 1, '8BUI', 2, 0), 2, '8BUI', 20, 0) AS rast
+ )
+ SELECT ST_Union(rast) AS rast FROM foo;
+WITH foo AS (SELECT ST_Tile(rast, 3, 3, TRUE) AS rast FROM raster_tile) SELECT (ST_DumpValues(rast, array[1,2,3])).* FROM foo;
+DROP TABLE IF EXISTS raster_tile;