Bug report #13594
DB Manager - unable to add a Postgres/PostGIS raster as layer
|Affected QGIS version:||2.10.1||Regression?:||No|
|Operating System:||Ubuntu||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||21636|
Scenario: raster loaded into postgres database with raster2pgsql. Attempting to "add as layer" from DB Manager causes the message "XXX is an invalid layer - not loaded"
Looking at stderr, I see the error message
ERROR 1: User parameter must be provided, or PGUSER environment variable must be set. Please set the user and try again.
Setting these environment variables and reconnecting doesn't appear to work. Also tried changing table and database owners, and re-creating the postgis connection.
The gdal url shown in the message log is missing the 'user' and 'password' parameters. If I add these manually to the url and add the layer with the following python from the console it works...
rl = QgsRasterLayer("PG: dbname=rastertest host=127.0.0.1 user=scott password=tiger port=5432 mode=2 schema=public column=rast table=mytable", "testlayer") QgsMapLayerRegistry.instance().addMapLayer(rl)
I suspect that Db Manager may not be adding the user and password settings to the GDAL URL.