Bug report #17104

Import into PostGIS in processing raises Exception when used without Postgresql connections

Added by Richard Duivenvoorde over 2 years ago. Updated over 2 years ago.

Status:Closed
Priority:High
Assignee:Victor Olaya
Category:Processing/Core
Affected QGIS version:master Regression?:Yes
Operating System:Debian Testing Easy fix?:Yes
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:25003

Description

See title: when you do NOT have any Postgresql connections, clicking on 'Import into Postgis' in the Database group of Processing raises an exception, see below.

I debugged and will provide small patch/PR

processing.tools.postgis.DbError: MESSAGE: There is no defined database connection "". 
Traceback (most recent call last):
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/gui/ProcessingToolbox.py", line 278, in executeAlgorithm
    dlg = AlgorithmDialog(alg)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/gui/AlgorithmDialog.py", line 74, in __init__
    self.setMainWidget(self.getParametersPanel(alg, self))
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/gui/AlgorithmDialog.py", line 85, in getParametersPanel
    return ParametersPanel(parent, alg)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/gui/ParametersPanel.py", line 80, in __init__
    self.initWidgets()
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/gui/ParametersPanel.py", line 178, in initWidgets
    wrapper.postInitialize(list(self.wrappers.values()))
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/gui/wrappers_postgis.py", line 95, in postInitialize
    self.setConnection(wrapper.value())
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/gui/wrappers_postgis.py", line 108, in setConnection
    self._database = GeoDB.from_name(connection)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/tools/postgis.py", line 179, in from_name
    uri = uri_from_name(conn_name)
  File "/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing/tools/postgis.py", line 47, in uri_from_name
    raise DbError(QCoreApplication.translate("PostGIS", 'There is no defined database connection "{0}".').format(conn_name))
processing.tools.postgis.DbError: MESSAGE: There is no defined database connection "".

Python version: 3.5.4 (default, Aug 12 2017, 14:08:14) [GCC 7.1.0] 
QGIS version: 2.99.0-Master Master, c43cd995a2 

Python Path:
/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins/processing
/home/richard/bin/qgis_all/master/debug/share/qgis/python
/home/richard/.local/share/QGIS/QGIS3/profiles/default/python
/home/richard/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/home/richard/bin/qgis_all/master/debug/share/qgis/python/plugins
/usr/lib/python35.zip
/usr/lib/python3.5
/usr/lib/python3.5/plat-x86_64-linux-gnu
/usr/lib/python3.5/lib-dynload
/usr/local/lib/python3.5/dist-packages
/usr/lib/python3/dist-packages
/home/richard/.local/share/QGIS/QGIS3/profiles/default/python

History

#1 Updated by Giovanni Manghi over 2 years ago

  • Regression? changed from No to Yes
  • Priority changed from Normal to High

#2 Updated by Giovanni Manghi over 2 years ago

  • Status changed from Open to In Progress

#3 Updated by Alexander Bruy over 2 years ago

  • Resolution set to fixed/implemented
  • Status changed from In Progress to Closed

Also available in: Atom PDF