Bug report #13482
only first element selectable in spatialite layer
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Data Provider/SpatiaLite | ||
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 |
Description
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.
Related issues
History
#1 Updated by Jochen Huber about 9 years ago
Bug report #13437 (Mismatched selection on a query based spatialite layer on 2.10 64bit) describes the same problem for layers based on queries. In the cases I tested it occured also when linking tables directly.
#2 Updated by Jochen Huber about 9 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 almost 9 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.
#4 Updated by Giovanni Manghi over 7 years ago
- Regression? set to No
- Easy fix? set to No
#5 Updated by Giovanni Manghi over 5 years ago
- Resolution set to end of life
- Status changed from Open to Closed
End of life notice: QGIS 2.18 LTR
Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/