[Qgis-developer] DbManager - new sqlite PRAGMA index_list returns more columns than expected

kimaidou kimaidou at gmail.com
Fri Jan 15 02:29:32 PST 2016


Hi all,

Some users reported a bug in DbManager. When you connect to a 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

Then a bug fix has been added for retro-compatibility if index_info , but
not for index_list

https://github.com/mackyle/sqlite/commit/53555d6da78e52a430b1884b5971fef33e9ccca4

We need to backport a bug fix, if it is done in DbManager

I have opened a bug in the hub, since I have not been able to find a
corresponding issue.
http://hub.qgis.org/issues/14110

I will try to debug it quicky, or have someone already worked on it ?

Cheers
Michaƫl
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160115/8cdc73e6/attachment.html>


More information about the Qgis-developer mailing list