Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't open PostGIS database in DBManager, QVariant error #27068

Closed
qgib opened this issue Jun 22, 2018 · 1 comment
Closed

Can't open PostGIS database in DBManager, QVariant error #27068

qgib opened this issue Jun 22, 2018 · 1 comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin Regression Something which used to work, but doesn't anymore

Comments

@qgib
Copy link
Contributor

qgib commented Jun 22, 2018

Author Name: Etienne Trimaille (@Gustry)
Original Redmine Issue: 19240
Affected QGIS version: 3.1(master)
Redmine category:db_manager


While I'm trying to connect to my PG database in the DB Manager:

An error has occurred while executing Python code: 

TypeError: unable to convert a QVariant of type 10 to a QMetaType of type 2 
Traceback (most recent call last):
  File "/home/etienne/dev/qgis/build/master/output/python/plugins/db_manager/db_model.py", line 441, in rowCount
    self._refreshIndex(parent, True)
  File "/home/etienne/dev/qgis/build/master/output/python/plugins/db_manager/db_model.py", line 490, in _refreshIndex
    if item.populate():
  File "/home/etienne/dev/qgis/build/master/output/python/plugins/db_manager/db_model.py", line 167, in populate
    if not connection.connect():
  File "/home/etienne/dev/qgis/build/master/output/python/plugins/db_manager/db_plugins/postgis/plugin.py", line 88, in connect
    sslmode = settings.value("sslmode", QgsDataSourceUri.SslPrefer, type=int)
TypeError: unable to convert a QVariant of type 10 to a QMetaType of type 2

I couldn't expand it in the tree view (see tables, execute queries etc...)
I got this error on 2 computers with 2 different databases so it might happen to someone else.

I fixed it by going into QGIS Settings, Advanced, and then "PostgreSQL/connections/my_connection/sslmode" = 1, it was previously a string like "SslDisable". I'm not sure how I got a string instead of integer. Now I can open again the DB Manager.

@qgib
Copy link
Contributor Author

qgib commented Jun 22, 2018

Author Name: Nyall Dawson (@nyalldawson)


Applied in changeset 12efb86.


  • done_ratio was changed from 0 to 100
  • status_id was changed from Open to Closed

@qgib qgib closed this as completed Jun 22, 2018
@qgib qgib added Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin Regression Something which used to work, but doesn't anymore labels May 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! DB Manager Relating to the DB Manager core plugin Regression Something which used to work, but doesn't anymore
Projects
None yet
Development

No branches or pull requests

1 participant