Bug report #13594

DB Manager - unable to add a Postgres/PostGIS raster as layer

Added by Steven Kay about 9 years ago. Updated about 9 years ago.

Status:Closed
Priority:High
Assignee:-
Category:DB Manager
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

Description

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.

Associated revisions

Revision 53c507d3
Added by Jürgen Fischer about 9 years ago

db manager: add credentials to postgis rasters (fixes #13594)

Revision 75b4d9e3
Added by Jürgen Fischer about 9 years ago

db manager: add credentials to postgis rasters (fixes #13594)

(backports from commit 53c507d)

History

#1 Updated by Jürgen Fischer about 9 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF