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

DB Manager Fails to Load Raster | QGIS 2.0.1 #17594

Closed
qgib opened this issue Oct 20, 2013 · 7 comments
Closed

DB Manager Fails to Load Raster | QGIS 2.0.1 #17594

qgib opened this issue Oct 20, 2013 · 7 comments
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

Comments

@qgib
Copy link
Contributor

qgib commented Oct 20, 2013

Author Name: Matthew Kenny (Matthew Kenny)
Original Redmine Issue: 8920
Affected QGIS version: 2.0.1
Redmine category:db_manager


Hello, I'm receiving the following error below when trying to load a raster stored in PostGIS, via the QGIS db manager plugin. I'm currently using a QGIS on a Mac, with the following build notes:

QGIS version 2.0.1-Dufour QGIS code revision f738351
Compiled against Qt 4.8.5 Running against Qt 4.8.5
Compiled against GDAL/OGR 1.10.1 Running against GDAL/OGR 1.10.1
Compiled against GEOS 3.4.2-CAPI-1.8.2 Running against GEOS 3.4.2-CAPI-1.8.2 r3921
PostgreSQL Client Version 9.2.4 SpatiaLite Version 4.1.1
QWT Version 6.0.2 PROJ.4 Version 480
QScintilla2 Version 2.7.2

An error has occured while executing Python code:

Traceback (most recent call last):
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_manager.py", line 83, in itemChanged
    self.refreshTabs()
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_manager.py", line 134, in refreshTabs
    self.info.showInfo( item )
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/info_viewer.py", line 75, in showInfo
    self._showTableInfo(item)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/info_viewer.py", line 132, in _showTableInfo
    html += table.info().toHtml()
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/info_model.py", line 352, in toHtml
    ret = self.getTableInfo()
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/postgis/info_model.py", line 194, in getTableInfo
    ret = TableInfo.getTableInfo(self)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/info_model.py", line 285, in getTableInfo
    general_info = self.generalInfo()
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/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 "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 613, in fields
    self._fields = map(lambda x: self.tableFieldsFactory(x, self), fields)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 613, in 
    self._fields = map(lambda x: self.tableFieldsFactory(x, self), fields)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/postgis/plugin.py", line 229, in tableFieldsFactory
    return PGTableField(row, table)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/postgis/plugin.py", line 311, in __init__
    for con in self.table().constraints():
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 660, in constraints
    self._constraints = map(lambda x: self.tableConstraintsFactory(x, self), constraints)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/plugin.py", line 660, in 
    self._constraints = map(lambda x: self.tableConstraintsFactory(x, self), constraints)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/postgis/plugin.py", line 232, in tableConstraintsFactory
    return PGTableConstraint(row, table)
  File "/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/db_manager/db_plugins/postgis/plugin.py", line 334, in __init__
    self.foreignMatchType = TableConstraint.matchTypes[row[9]]
KeyError: u's'

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:
2.0.1-Dufour Dufour, f738351

Python path: ['/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins/processing', '/Applications/QGIS.app/Contents/MacOS/../Resources/python', '/Users/matt/.qgis2/python', '/Users/matt/.qgis2/python/plugins', '/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins', '/Library/Frameworks/SQLite3.framework/Versions/B/Python/2.7', '/Library/Frameworks/GEOS.framework/Versions/3/Python/2.7', '/Library/Frameworks/GDAL.framework/Versions/1.10/Python/2.7/site-packages', '/Library/Python/2.7/site-packages/swampy-2.1.1-py2.7.egg', '/Library/Python/2.7/site-packages/pygooglechart-0.3.0-py2.7.egg', '/Library/Python/2.7/site-packages/GChartWrapper-0.9-py2.7.egg', '/Library/Python/2.7/site-packages/pip-1.2.1-py2.7.egg', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC', '/Library/Python/2.7/site-packages', '/Applications/QGIS.app/Contents/Resources/python/plugins/fTools/tools']

@qgib
Copy link
Contributor Author

qgib commented Oct 20, 2013

Author Name: Giovanni Manghi (@gioman)


  • category_id was configured as DB Manager

@qgib
Copy link
Contributor Author

qgib commented Nov 11, 2013

Author Name: Max Bohnet (Max Bohnet)


The error occures not only with raster tables but with all tables, that have a foreign key constraint with a "MATCH SIMPLE" match type.
I added 's': 'SIMPLE' to the matchTypes-Dictionary of the TableConstraint class in line 988 in db_plugins\plugins.py. So it works fine for me:
matchTypes = { "u" : "UNSPECIFIED", "f" : "FULL", "p" : "PARTIAL" , "s": 'SIMPLE',}

How can i submit that patch?

@qgib
Copy link
Contributor Author

qgib commented Nov 25, 2013

Author Name: C Daniel Sanchez R. (C Daniel Sanchez R.)


This bug is present in 2.1.0-Master (Debian Jessie amd64, Nightly build), and postgreSQL 9.3
Patch suggested by Max corrects this error. Please apply it as soon as possible.

Thanks.

@qgib
Copy link
Contributor Author

qgib commented Nov 26, 2013

Author Name: Giovanni Manghi (@gioman)


Max Bohnet wrote:

The error occures not only with raster tables but with all tables, that have a foreign key constraint with a "MATCH SIMPLE" match type.
I added 's': 'SIMPLE' to the matchTypes-Dictionary of the TableConstraint class in line 988 in db_plugins\plugins.py. So it works fine for me:
matchTypes = { "u" : "UNSPECIFIED", "f" : "FULL", "p" : "PARTIAL" , "s": 'SIMPLE',}

How can i submit that patch?

Please submit the patch as pull request in the qgis github repository

https://github.com/qgis/QGIS/commits/master


  • fixed_version_id was configured as Future Release - High Priority
  • pull_request_patch_supplied was changed from 0 to 1
  • status_id was changed from Open to Feedback

@qgib
Copy link
Contributor Author

qgib commented Dec 27, 2013

Author Name: Tim Sutton (Tim Sutton)


I merged your pull request here #1042 - many thanks!

@qgib
Copy link
Contributor Author

qgib commented Dec 27, 2013

Author Name: Tim Sutton (Tim Sutton)


  • resolution was changed from to fixed/implemented

@qgib
Copy link
Contributor Author

qgib commented Dec 28, 2013

Author Name: Matthias Kuhn (@m-kuhn)


  • status_id was changed from Feedback to Closed

@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 labels May 24, 2019
@qgib qgib added this to the Future Release - High Priority milestone May 24, 2019
@qgib qgib closed this as completed May 24, 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
Projects
None yet
Development

No branches or pull requests

1 participant