Bug report #13594
DB Manager - unable to add a Postgres/PostGIS raster as layer
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
db manager: add credentials to postgis rasters (fixes #13594)
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
Fixed in changeset 53c507d3a75234be0fa5e3fad6c0fe4670348fc9.