Skip to content

Commit

Permalink
Allow loading PostGIS Rasters from partially configured connections
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Sandro Santilli committed Sep 4, 2014
1 parent f14ad55 commit e91141c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion python/plugins/db_manager/db_plugins/postgis/plugin.py
Expand Up @@ -278,7 +278,13 @@ def info(self):
def gdalUri(self):
uri = self.database().uri()
schema = ( u'schema=%s' % self.schemaName() ) if self.schemaName() else ''
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)
dbname = ( u'dbname=%s' % uri.database() ) if uri.database() else ''
host = ( u'host=%s' % uri.host() ) if uri.host() else ''
user = ( u'user=%s' % uri.username() ) if uri.username() else ''
passw = ( u'password=%s' % uri.password() ) if uri.password() else ''
port = ( u'port=%s' % uri.port() ) if uri.port() else ''
gdalUri = u'PG: %s %s %s %s %s mode=2 %s table=%s' % \
(dbname, host, user, passw, port, schema, self.name)
return gdalUri

def mimeUri(self):
Expand Down

0 comments on commit e91141c

Please sign in to comment.