Bug report #16625

DBManager fails to load raster from dbname-less connection

Added by Sandro Santilli over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:High
Assignee:Sandro Santilli
Category:DB Manager
Affected QGIS version:2.18.9 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24525

Description

I made a PostGIS connection with no database name, to rely on libpq defaults.
DBManager is capable of using the connection and shows me the available tables, but when attempting to add a raster layer on the map I get an error about the connection being invalid, specifying that "Cannot open GDAL dataset 'PG:..' You must specify at least a db name".

Note that loading a Vector (GEOMETRY) layer or a simple table works just fine.

I guess DBManager could figure out the dbname from the connection and pass it to GDAL, as a fix.


Related issues

Related to QGIS Application - Bug report #10600: db_manager is unable to load rasters from connections wit... Closed 2014-06-16
Related to QGIS Application - Bug report #14436: Failure to connect to postgres database defined as servic... Closed 2016-03-07

Associated revisions

Revision 13e39da0
Added by Sandro Santilli over 7 years ago

Ensure "dbname" is set in the uri, once again

Fixes #16625 (ref #10600)

Revision d1e8903c
Added by Sandro Santilli over 7 years ago

Ensure "dbname" is set in the uri, once again

Fixes #16625 (ref #10600)

Revision 78c34238
Added by Sandro Santilli over 7 years ago

For GDAL sake extract a dbname from the connection

Works around GDAL limitation reported in:
https://trac.osgeo.org/gdal/ticket/6910

Ref #16625
Ref #16626

Revision 6f42b784
Added by Sandro Santilli over 7 years ago

For GDAL sake extract a dbname from the connection

Works around GDAL limitation reported in:
https://trac.osgeo.org/gdal/ticket/6910

Ref #16625
Closes #16626

Revision 3efee437
Added by Sandro Santilli over 7 years ago

Add test for DBManager's PostGIS connector and plugin

Only enabled when ENABLE_PGTEST is set
Includes test for dbname-less URI and service-only URI
(ref #10600 ref #16625 ref #16626)

The test connects to the `qgis_test` database, or what the
QGIS_PGTEST_DB variable requests (as per tests/README.md)

A raster table is added to the test postgis setup script,
for use by this new test.

History

#1 Updated by Sandro Santilli over 7 years ago

  • Regression? changed from No to Yes

It looks like this regressed after 2.2.0 (see #10600)

#2 Updated by Giovanni Manghi over 7 years ago

  • Priority changed from Normal to High

#3 Updated by Sandro Santilli over 7 years ago

  • Assignee set to Alessandro Pasotti

Alessandro: I think the regression was introduced by 212b125a2c2eba93f2c8e3b991ea4be4fdc57623

#4 Updated by Sandro Santilli over 7 years ago

  • Related to Bug report #10600: db_manager is unable to load rasters from connections with no dbname specified added

#5 Updated by Sandro Santilli over 7 years ago

  • Assignee changed from Alessandro Pasotti to Sandro Santilli

I'm looking at it, might be an easy fix (None vs. empty-string)

#6 Updated by Sandro Santilli over 7 years ago

  • Pull Request or Patch supplied changed from No to Yes

#7 Updated by Sandro Santilli over 7 years ago

  • Status changed from Open to Closed
  • % Done changed from 0 to 100

#8 Updated by Sandro Santilli over 7 years ago

  • Status changed from Closed to Open

Reopening as it's pending backport to 2.18 branch (2.18.9 also affected)

#9 Updated by Sandro Santilli over 7 years ago

  • Related to Bug report #14436: Failure to connect to postgres database defined as service in DB manager added

#10 Updated by Sandro Santilli over 7 years ago

  • Affected QGIS version changed from 2.18.8 to 2.18.9

#11 Updated by Sandro Santilli over 7 years ago

  • Status changed from Open to Closed

#12 Updated by Sandro Santilli over 7 years ago

As this might strike again in the future, this comment is to mention the main problem is upstream where GDAL requires a dbname to be written in the datasource:
https://trac.osgeo.org/gdal/ticket/6910

Also available in: Atom PDF