Bug report #14110
Spatialite / DbManager - Error fetching indexes with recent sqlite version
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | - | ||
Category: | DB Manager | ||
Affected QGIS version: | 2.12.2 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | Yes | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 22115 |
Description
Some users reported a bug in DbManager. When you connect to a sqlite/spatialite database, and then click on one layer, the plugin tries to fetch information about the layer and its indexes.
The method "getTableIndexes" situated in line 371 of the file "db_manager/db_plugins/spatialite/connector.py"expects to get 3 fields from the sqlite method "PRAGMA index_list"
In recent version of SQLite, though, this method now returns 5 fields, for example
sqlite> pragma index_list(geo_parcelle); 0|idx_geo_parcelle_ogc_fid|0|c|0 1|geo_parcelle_voie_idx|0|c|0 2|geo_parcelle_comptecommunal_idx|0|c|0
This leads to a Python error :
File "/usr/share/qgis/python/plugins/db_manager/db_plugins/spatialite/connector.py", line 371, in getTableIndexes num, name, unique = idx ValueError: too many values to unpack
A change has been made in sqlite code, see https://github.com/mackyle/sqlite/commit/efa3207797a6ff4eb6a514fad5c99cf67c056492
We need to backport a bug fix, if it is done in DbManager
Associated revisions
[bugfix][DbManager] 14110 - Error fetching layer indexes with recent sqlite version
Fixes #14110
The method `getTableIndexes`, situated in line 371 of the file `db_manager/db_plugins/spatialite/connector.py`,
expected to get 3 fields from the sqlite method `PRAGMA index_list` .
In recent versions of SQLite, since 3.8.9, though, this method now returns 5 fields.
This commit fixes this issue by checking the length of columns returned by the method.
[bugfix][DbManager] 14110 - Error fetching layer indexes with recent sqlite version
Fixes #14110
The method `getTableIndexes`, situated in line 371 of the file `db_manager/db_plugins/spatialite/connector.py`,
expected to get 3 fields from the sqlite method `PRAGMA index_list` .
In recent versions of SQLite, since 3.8.9, though, this method now returns 5 fields.
This commit fixes this issue by checking the length of columns returned by the method.
[bugfix][DbManager] 14110 - Error fetching layer indexes with recent sqlite version
Fixes #14110
The method `getTableIndexes`, situated in line 371 of the file `db_manager/db_plugins/spatialite/connector.py`,
expected to get 3 fields from the sqlite method `PRAGMA index_list` .
In recent versions of SQLite, since 3.8.9, though, this method now returns 5 fields.
This commit fixes this issue by checking the length of columns returned by the method.
History
#1 Updated by Michael Douchin almost 9 years ago
I have seen a commit had been added in sqlite to revert the columns number changed for index_info. I added a comment in this commit to ask the same revert for index_list : https://github.com/mackyle/sqlite/commit/53555d6da78e52a430b1884b5971fef33e9ccca4#commitcomment-15471730
#2 Updated by Michael Douchin almost 9 years ago
- Pull Request or Patch supplied changed from No to Yes
Pull request to fix it : https://github.com/qgis/QGIS/pull/2696
#3 Updated by Giuseppe Sucameli almost 9 years ago
- Status changed from Open to Closed
Fixed in changeset 472fa9bb080c65ba9acdc83c30354f7849b74a83.