Bug report #7544

DB manager raster constraints error

Added by asdf asdf about 11 years ago. Updated about 11 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:DB Manager
Affected QGIS version:master Regression?:No
Operating System:Windows 7 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16487

Description

DB manager reports a python error while adding raster layer from postgis database. The bug probably has something to do with the additional raster constraints.

Postgis version: "POSTGIS="2.1.0SVN r11118" GEOS="3.4.0dev-CAPI-1.8.0 r0" PROJ="Rel. 4.8.0, 6 March 2012" GDAL="GDAL 1.9.2, released 2012/10/08 GDAL_DATA not found" LIBXML="2.7.8" LIBJSON="UNKNOWN" TOPOLOGY RASTER"

Table was created with the following command: raster2pgsql input.tif -s 3067 -P -C -r -M -l 2,4 -N none -I -t 250x250 tablename > tmp.sql

An error has occured while executing Python code:

Traceback (most recent call last):
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_manager.py", line 99, in itemChanged
    self.refreshTabs()
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_manager.py", line 150, in refreshTabs
    self.info.showInfo( item )
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\info_viewer.py", line 73, in showInfo
    self._showTableInfo(item)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\info_viewer.py", line 121, in _showTableInfo
    html += table.info().toHtml()
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\info_model.py", line 361, in toHtml
    ret = self.getTableInfo()
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\postgis\\info_model.py", line 166, in getTableInfo
    ret = TableInfo.getTableInfo(self)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\info_model.py", line 294, in getTableInfo
    general_info = self.generalInfo()
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\postgis\\info_model.py", line 95, in generalInfo
    if len( filter(lambda fld: fld.primaryKey, self.table.fields()) )   File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 609, in fields
    self._fields = map(lambda x: self.tableFieldsFactory(x, self), fields)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 609, in 
    self._fields = map(lambda x: self.tableFieldsFactory(x, self), fields)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 233, in tableFieldsFactory
    return PGTableField(row, table)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 318, in __init__
    for con in self.table().constraints():
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 654, in constraints
    self._constraints = map(lambda x: self.tableConstraintsFactory(x, self), constraints)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 654, in 
    self._constraints = map(lambda x: self.tableConstraintsFactory(x, self), constraints)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 236, in tableConstraintsFactory
    return PGTableConstraint(row, table)
  File "C:\\OSGeo4W\\apps\\qgis\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 329, in __init__
    self.type = TableConstraint.types[constr_type]  # convert to enum
KeyError: u'x'

Python version:
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS version:
1.8.0-Lisboa Lisboa, f440b60

Python path: ['C:/OSGeo4W/apps/qgis/./python', 'C:/Users/Sigala/.qgis//python', 'C:/Users/Sigala/.qgis//python/plugins', 'C:/OSGeo4W/apps/qgis/./python/plugins', 'C:\\\\Windows\\\\system32\\\\python27.zip', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\DLLs', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\plat-win', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\lib-tk', 'C:\\\\OSGeo4W\\\\apps\\\\qgis\\\\bin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\PIL', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\Pythonwin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\wx-2.8-msw-unicode', 'C:\\\\OSGeo4W\\\\apps\\\\qgis\\\\python\\\\plugins\\\\fTools\\\\tools']

Associated revisions

Revision f5aef0f5
Added by Giuseppe Sucameli about 11 years ago

DBManager: better handle for not supported constraint types (fix #7544)

History

#1 Updated by Jürgen Fischer about 11 years ago

  • Affected QGIS version changed from master to 1.8.0

Does this also occur in master?

#2 Updated by Jürgen Fischer about 11 years ago

  • Subject changed from DB manager raster constraits error to DB manager raster constraints error

#3 Updated by asdf asdf about 11 years ago

Jürgen Fischer wrote:

Does this also occur in master?

Here's the error from the master. Looks like same error to me.

An error has occured while executing Python code:

Traceback (most recent call last):
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_manager.py", line 83, in itemChanged
    self.refreshTabs()
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_manager.py", line 134, in refreshTabs
    self.info.showInfo( item )
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\info_viewer.py", line 75, in showInfo
    self._showTableInfo(item)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\info_viewer.py", line 132, in _showTableInfo
    html += table.info().toHtml()
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\info_model.py", line 352, in toHtml
    ret = self.getTableInfo()
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\postgis\\info_model.py", line 194, in getTableInfo
    ret = TableInfo.getTableInfo(self)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\info_model.py", line 285, in getTableInfo
    general_info = self.generalInfo()
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\postgis\\info_model.py", line 95, in generalInfo
    if len( filter(lambda fld: fld.primaryKey, self.table.fields()) )   File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 608, in fields
    self._fields = map(lambda x: self.tableFieldsFactory(x, self), fields)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 608, in 
    self._fields = map(lambda x: self.tableFieldsFactory(x, self), fields)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 233, in tableFieldsFactory
    return PGTableField(row, table)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 315, in __init__
    for con in self.table().constraints():
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 655, in constraints
    self._constraints = map(lambda x: self.tableConstraintsFactory(x, self), constraints)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\plugin.py", line 655, in 
    self._constraints = map(lambda x: self.tableConstraintsFactory(x, self), constraints)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 236, in tableConstraintsFactory
    return PGTableConstraint(row, table)
  File "C:\\OSGeo4W\\apps\\qgis-dev\\python\\plugins\\db_manager\\db_plugins\\postgis\\plugin.py", line 326, in __init__
    self.type = TableConstraint.types[constr_type]  # convert to enum
KeyError: u'x'

Python version:
2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]

QGIS version:
1.9.0-Master Master, 082c6ba

Python path: ['C:/OSGeo4W/apps/qgis-dev/./python', 'C:\\\\Users\\\\Sigala/.qgis2/python', 'C:\\\\Users\\\\Sigala/.qgis2/python/plugins', 'C:/OSGeo4W/apps/qgis-dev/./python/plugins', 'C:\\\\OSGeo4W\\\\bin\\\\python27.zip', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\DLLs', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\plat-win', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\lib-tk', 'C:\\\\OSGeo4W\\\\bin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\PIL', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\win32\\\\lib', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\Pythonwin', 'C:\\\\OSGeo4W\\\\apps\\\\Python27\\\\lib\\\\site-packages\\\\wx-2.8-msw-unicode', 'C:\\\\OSGeo4W\\\\apps\\\\qgis-dev\\\\python\\\\plugins\\\\fTools\\\\tools']

#4 Updated by Jürgen Fischer about 11 years ago

  • Affected QGIS version changed from 1.8.0 to master

#5 Updated by Giuseppe Sucameli about 11 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF