Skip to content

Commit e91141c

Browse files
author
Sandro Santilli
committed
Allow loading PostGIS Rasters from partially configured connections
Partially configured connection are those for which an hostname or username or port etc. are not specified, relying on libpq defaults. It was already fixed for geometries but rasters needed more love. See #9037.
1 parent f14ad55 commit e91141c

File tree

1 file changed

+7
-1
lines changed
  • python/plugins/db_manager/db_plugins/postgis

1 file changed

+7
-1
lines changed

python/plugins/db_manager/db_plugins/postgis/plugin.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,13 @@ def info(self):
278278
def gdalUri(self):
279279
uri = self.database().uri()
280280
schema = ( u'schema=%s' % self.schemaName() ) if self.schemaName() else ''
281-
gdalUri = u'PG: dbname=%s host=%s user=%s password=%s port=%s mode=2 %s table=%s' % (uri.database(), uri.host(), uri.username(), uri.password(), uri.port(), schema, self.name)
281+
dbname = ( u'dbname=%s' % uri.database() ) if uri.database() else ''
282+
host = ( u'host=%s' % uri.host() ) if uri.host() else ''
283+
user = ( u'user=%s' % uri.username() ) if uri.username() else ''
284+
passw = ( u'password=%s' % uri.password() ) if uri.password() else ''
285+
port = ( u'port=%s' % uri.port() ) if uri.port() else ''
286+
gdalUri = u'PG: %s %s %s %s %s mode=2 %s table=%s' % \
287+
(dbname, host, user, passw, port, schema, self.name)
282288
return gdalUri
283289

284290
def mimeUri(self):

0 commit comments

Comments
 (0)