qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.55k stars 2.99k forks source link

Spatialite provider does not support alphanumeric primary keys #22946

Closed qgib closed 5 years ago

qgib commented 8 years ago

Author Name: Frank Donnelly (Frank Donnelly) Original Redmine Issue: 14999 Affected QGIS version: 2.14.3 Redmine category:data_provider/spatialite


I'm using QGIS 2.14 Essen on a Windows 7 machine (specifically 2.14.3). If I connect to a Spatialite database, add a layer to my layers panel, and open the attribute table of the layer, QGIS populates all the cell values with the word ERROR. If I sort the table, QGIS populates all the cells with the values of one record.

However:

  1. If I use the Identify Feature tool, I can click on a feature and successfully view its attributes
  2. If I use the Database Manager, I can view the entire table and it renders perfectly
  3. If I use another program (Spatialite GUI, ArcGIS) I can see the attributes just fine
  4. If I use an older version of QGIS - 2.8 Wien - the error doesn't occur

I've noticed that this only happens when a layer's unique ID is a text value that contains alpha characters. If the layer has an integer ID, or has a text ID where all the characters are numeric, the error doesn't occur. But this shouldn't be happening - all of the layers have a unique rowid integer column that Spatialite/SQLite creates by default, and if the attribute table viewer needs a unique numeric id to function it should look at that rowid column.

Sample database file is attached. Train station layer fails (text id, mix of alpha and numeric). Subway station layer partially fails (text id, ids that are numeric work, alpha and numeric fails). Borough layer works fine (text id, all numeric).



Related issue(s): #22548 (duplicates), #22591 (duplicates) Redmine related issue(s): 14575, 14626


qgib commented 8 years ago

Author Name: Matthias Kuhn (@m-kuhn)


qgib commented 8 years ago

Author Name: Even Rouault (@rouault)


This is a duplicate of #22548 and #22591.


qgib commented 8 years ago

Author Name: Frank Donnelly (Frank Donnelly)


Sorry for the duplication. The target version for this fix is 2.16 - that means this won't be back-ported to a future point release of 2.14? For many who only adopt the LTS releases, this is a make or break issue.

qgib commented 8 years ago

Author Name: Even Rouault (@rouault)


Backported to 2.14