Bug report #18204
Failure to load PostGIS raster without bands
|Affected QGIS version:||3.3(master)||Regression?:||Yes|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||worksforme|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||26095|
List of tables, inlcuding rasters, are correctly displayed in DB Manager. When double clicking, loading fails with the message:
Cannot open GDAL dataset PG: dbname= Couldn't establish database connection
In the dialog, username and password are requested.
Vectors are loaded correctly.
-- create an empty table CREATE TABLE public.test_raster ( rid integer, rast raster, CONSTRAINT enforce_height_rast CHECK (st_height(rast) = ANY (ARRAY[100, 24])), CONSTRAINT enforce_width_rast CHECK (st_width(rast) = ANY (ARRAY[100, 24])), CONSTRAINT enforce_srid_rast CHECK (st_srid(rast) = 4326) ); -- create an empty raster INSERT INTO test_raster(rid,rast) VALUES(1, ST_MakeEmptyRaster( 100, 100, 0.0005, 0.0005, 1, 1, 0, 0, 4326) ); -- add primary key ALTER TABLE test_raster ADD CONSTRAINT test_pkey PRIMARY KEY (rid);
#4 Updated by Alessandro Pasotti about 2 years ago
- Status changed from Open to Feedback
I could not reproduce exactly the same issue as I get a different message from DB manager: "Cannot get GDAL raster band:"
As reported by https://postgis.net/docs/RT_ST_MakeEmptyRaster.html , a raster with 0 bands is created by ST_MakeEmptyRaster, QGIS needs at least one band so this error makes sense.
The error you mention about the connection appears to be different and I cannot reproduce it.