Bug report #8191
PostgreSQL not working in DB Manager
| Status: | Closed | ||
|---|---|---|---|
| Priority: | Severe/Regression | ||
| Assignee: | - | ||
| Category: | DB Manager | ||
| Affected QGIS version: | master | Regression?: | No |
| Operating System: | OX X | Easy fix?: | No |
| Pull Request or Patch supplied: | No | Resolution: | fixed |
| Crashes QGIS or corrupts data: | No | Copied to github as #: | 17009 |
Description
This worked prior to the SIP changes. When I click on the triangle to display the schemas and tables in our PostgreSQL database, I get the following error.
An error has occured while executing Python code:
Traceback (most recent call last):
File "/Applications/QGIS_2.0-dev.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 402, in rowCount
self._refreshIndex( parent, True )
File "/Applications/QGIS_2.0-dev.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 454, in _refreshIndex
if item.populate():
File "/Applications/QGIS_2.0-dev.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_model.py", line 151, in populate
if not connection.connect():
File "/Applications/QGIS_2.0-dev.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/postgis/plugin.py", line 89, in connect
uri.setConnection(service, database, username, password, sslmode)
TypeError: arguments did not match any overloaded call:
QgsDataSourceURI.setConnection(QString, QString, QString, QString, QString, QgsDataSourceURI.SSLmode sslmode=QgsDataSourceURI.SSLprefer): argument 1 has unexpected type 'QPyNullVariant'
QgsDataSourceURI.setConnection(QString, QString, QString, QString, QgsDataSourceURI.SSLmode sslmode=QgsDataSourceURI.SSLprefer): argument 1 has unexpected type 'QPyNullVariant'
Python version:
2.7.2 (default, Oct 11 2012, 20:14:37)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)]
QGIS version:
1.9.0-Master Master, 104b4d9
The problem occurs in line 88 of /Applications/QGIS_2.0-dev.app/Contents/Resources/python/plugins/db_manager/db_plugins/postgis/plugin.py:
if service != "":
uri.setConnection(service, database, username, password, sslmode)
else:
uri.setConnection(host, port, database, username, password, sslmode)
Service is not defined in our PostgreSQL database, however, service != "" in line 89 is returning True.
Changing the program so that the else always executes fixes the problem. I don't understand enough about QSettings() to offer a more robust fix.
Associated revisions
PostgreSQL not working in DB Manager (Fix #8191)
History
#1
Updated by Paolo Cavallini over 12 years ago
Are you sure your DB Manager is upgraded?
#2
Updated by Giovanni Manghi over 12 years ago
- Target version set to Version 2.0.0
- Category set to DB Manager
#3
Updated by Matthias Kuhn over 12 years ago
- Status changed from Open to Feedback
Can you try and confirm if the following change leads to the expected result:
if service:
uri.setConnection....
#4
Updated by rcline - over 12 years ago
- Status changed from Feedback to Closed
That fixed it. Thanks. Set to closed.
#5
Updated by Giovanni Manghi over 12 years ago
- Resolution set to fixed