Bug report #13482
only first element selectable in spatialite layer
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Windows (OSGeo4W64)||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||end of life|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||21527|
When using the "select single feature" tool to select features from a spatialite layer (testet with multiline, line, point and polygon), the feature which was the first to be added to the dataset is highlighted and selected regardless of the feature which is clicked. Thus only this feature can be selected interactively. Selection from the attribute table works for all features.
An example DB and project file are attached.
When exporting a dataset to shapefile and loading the shapoefile in QGIS, selection works as expected, so this seems to be a spatialite-specific problem.
#2 Updated by Jochen Huber over 4 years ago
The cause seems to be that QGIS requires Spatialite layers to have a numeric primary key field. If there is no primary key, all features are shown, but selection always picks the first element as described. If there is a primary key on a non-numeric field (text), features can be added but are not shown afterwards. Probably this is why in the case of bug report #13437 table layers work (because they have a suitable primary key) and query-based layers do not.
We often have datasets where text ids identify individual datasets (eg unique names of wells), so it would be good if qgis could use pkeys based on non-numeric fields.
If there is no easy solution, it would be good if qgis reported a warning when a spatialite layer (tabel- or query-based) is added and it does not find a suitable id field instead of behaving in unexpected ways.
#3 Updated by Grga Franges about 4 years ago
I also notice this behavior on spatialite database created by "Offline editing" tool. I have to note that the ID is numeric there (type is stated as qlonglong and type name as integer). I would also like to note that this was working ok in 2.8 and prior versions - problem first apeared with 2.10.
#5 Updated by Giovanni Manghi 11 months ago
- Resolution set to end of life
- Status changed from Open to Closed
End of life notice: QGIS 2.18 LTR