Skip to content
Browse files

[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/`,
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.
  • Loading branch information
mdouchin authored and rldhont committed Jan 19, 2016
1 parent e72e2ab commit 1f77694c21e6293c1333361f624e32d395edc387
Showing with 8 additions and 1 deletion.
  1. +8 −1 python/plugins/db_manager/db_plugins/spatialite/
@@ -302,7 +302,14 @@ def getTableIndexes(self, table):
indexes = c.fetchall()

for i, idx in enumerate(indexes):
num, name, unique = idx
# sqlite has changed the number of columns returned by index_list since 3.8.9
# I am not using self.getInfo() here because this behaviour
# can be changed back without notice as done for index_info, see:
if len(idx) == 3:
num, name, unique = idx
if len(idx) == 5:
num, name, unique, createdby, partial = idx
sql = u"PRAGMA index_info(%s)" % (self.quoteId(name))
self._execute(c, sql)

0 comments on commit 1f77694

Please sign in to comment.
You can’t perform that action at this time.