Bug report #16626

DBManager fails to load rasters from service-only PostGIS connections

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

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

Description

When PostGIS connections are defined by use of the "service" parameter the raster load (mediated by OGR) fails to work.
Other kind of layers (vector, table-only) work fine.

This is with GDAL-2.3.0 (not sure it matters)

The problem reported by GDAL is that you need at least a DBNAME.
The string passed to ogr doesn't look like including a "service" parameter so it's probbaly never sent by DBManager.


Related issues

Related to QGIS Application - Bug report #14436: Failure to connect to postgres database defined as servic... Closed 2016-03-07

Associated revisions

Revision 93624b08
Added by Sandro Santilli over 3 years ago

Pass "service" parameter to gdal when opening PostGIS Rasters

Closes #16626 for 2.18

Revision d74864bb
Added by Sandro Santilli over 3 years ago

Fix typo in URI service extraction (introduced in 93624b08)

Also add a comment about lack of support in GDAL up to 2.2.x for
service specification in datasource uri

Ref #16626

Revision 861cf9ab
Added by Sandro Santilli over 3 years ago

Fix typo in URI service extraction (introduced in 93624b08)

Also add a comment about lack of support in GDAL up to 2.2.x for
service specification in datasource uri

Ref #16626

Revision 78c34238
Added by Sandro Santilli over 3 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 3 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 362d4f06
Added by Sandro Santilli over 3 years ago

Add DBManager test for service-only URI

Ref #16626

Also fixes runs with non-standard QGIS_PGTEST_DB env variable set

Revision 3efee437
Added by Sandro Santilli over 3 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 3 years ago

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

#2 Updated by Sandro Santilli over 3 years ago

  • Pull Request or Patch supplied changed from No to Yes

#3 Updated by Sandro Santilli over 3 years ago

  • Affected QGIS version changed from 2.18.8 to 2.18.9

#4 Updated by Sandro Santilli over 3 years ago

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

#5 Updated by Sandro Santilli over 3 years ago

  • Status changed from Closed to Reopened

Reopening because it looks like ogr does not recognize "service" anyway, insisting about having a `dbname` value.

#6 Updated by Sandro Santilli over 3 years ago

So I guess a fix here would be to pre-connect with psycopg to find out the name of the database and provide it in the URI.

#7 Updated by Sandro Santilli over 3 years ago

Upstream ticket to GDAL was filed here: https://trac.osgeo.org/gdal/ticket/6910

#8 Updated by Sandro Santilli over 3 years ago

78c3423861 implements the fix suggested in #16626-6 for master branch
backport (and overall automated tests) still pending

#9 Updated by Sandro Santilli over 3 years ago

  • Status changed from Reopened to Closed

Also available in: Atom PDF