Skip to content

Commit 9cd39e7

Browse files
committed
[db_manager] Fix connection to postgis
1 parent 8b8bc26 commit 9cd39e7

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, uri):
6464

6565
expandedConnInfo = self._connectionInfo()
6666
try:
67-
self.connection = psycopg2.connect(expandedConnInfo.encode('utf-8'))
67+
self.connection = psycopg2.connect(expandedConnInfo)
6868
except self.connection_error_types() as e:
6969
err = str(e)
7070
uri = self.uri()
@@ -83,7 +83,7 @@ def __init__(self, uri):
8383

8484
newExpandedConnInfo = uri.connectionInfo(True)
8585
try:
86-
self.connection = psycopg2.connect(newExpandedConnInfo.encode('utf-8'))
86+
self.connection = psycopg2.connect(newExpandedConnInfo)
8787
QgsCredentials.instance().put(conninfo, username, password)
8888
except self.connection_error_types() as e:
8989
if i == 2:

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,9 @@ def connect(self, parent=None):
8888

8989
settings.endGroup()
9090

91+
if hasattr(authcfg, 'isNull') and authcfg.isNull():
92+
authcfg = ''
93+
9194
if service:
9295
uri.setConnection(service, database, username, password, sslmode, authcfg)
9396
else:

0 commit comments

Comments
 (0)