Bug report #15847
Cannot commit changes to Spatialite files when splitting features in 2.16.X and 2.18
|Affected QGIS version:||2.16.0||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||end of life|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||23765|
Hi, we've discovered an issue in QGIS 2.16 onward where we are unable to save changes to a Spatialite file when a feature is split. This also applies to geopackage and SQLite files.
This does not occur when creating a brand new Spatialite file from within QGIS and digitsing new features. But only when converting an existing file into Spatialite.
When saving after splitting a feature it displays this error message:
Could not commit changes to layer <layername>
Errors: SUCCESS: 1 geometries were changed.
ERROR: 1 feature(s) not added.
OGR error creating feature -2: sqlite3_step() failed:
UNIQUE constraint failed: <layername>.ogc_fid (19)
I have attached a zipfile containing a test file. If you try to split a feature in QGIS 2.16 or 2.18 then you will be unable to save your edits correctly. Only one of the resulting polygons will save.
This error is reproducible in both Windows and Linux.
This works correctly in 2.14
#2 Updated by Matthew Yandell-Thomas over 4 years ago
- File Capture.JPG added
Did you try to save your edits?
All our computers in the office running 2.18 cannot save edits to spatialite files if a feature has been split.
Whereas we do not experience the problem with the very same spatialite file in 2.14
I have just downloaded and installed the latest weekly build and the problem persists in that
#4 Updated by Richard Duivenvoorde over 4 years ago
@Nyall: any chance to fix this in 2.18/2.14 also? Because I think that those versions will be in use for a long time in some corporate/governance organisations...
@Matthew: does this also occur when using Geopackage or is there a reason to not use GeoPackage? (/me in role of OGC-standards enforcer and GeoPackage fanboy :-) )
#6 Updated by Randal Hale over 4 years ago
I can confirm with 2.18.1 - tried both Spatialite and Geopackage and it failed on a split - although - in both cases after the split and a save half the polygon was deleted. I also noticed (which I don't think is related) I can't import a layer into geopackage using DBManager. It errors out with a OGR complaint. Spatialite accepts an import with DBManager.
#7 Updated by Giovanni Manghi over 4 years ago
- Resolution set to worksforme
- Status changed from Feedback to Closed
I cannot replicate the issue with the provided data on 2.18.2 on both Linux and Windows. Please try a clean install by disabling/removing all 3rd party plugins and/or purging the .qgis2 folder. Please reopen if necessary.
#8 Updated by Nicolo Pitsch over 4 years ago
- Status changed from Closed to Reopened
I can confirm the bug with QGIS 2.18.3 on Windows, but only for GeoPackage (OGR error creating feature ...: failed to execute insert : UNIQUE constraint failed: ....fid). SpatiaLite on the other hand behaves correctly. I tried with newly created line- and polygon-layers respectively databases. After splitting with GeoPackage both line parts have the same fid, with SpatiaLite the fid of one part is empty.
With the testing data provided by @Matthew it fails for SQLite/SpatiaLite too.
I ask like @Richard whether there is a chance to fix this for 2.18 too. Such bugs are critical from the point of view to propose GeoPackage as the replacement for the Shapefile format.
#10 Updated by Giovanni Manghi over 2 years ago
- Resolution changed from worksforme to end of life
- Status changed from Reopened to Closed
End of life notice: QGIS 2.18 LTR
QGIS 3.4 has recently become our new Long Term Release (LTR) version. This is a major step in our history – a long term release version based on the massive updates, library upgrades and improvements that we carried out in the course of the 2.x to 3x upgrade cycle.
We strongly encourage all users who are currently using QGIS 2.18 LTR as their preferred QGIS release to migrate to QGIS 3.4. This new LTR version will receive regular bugfixes for at least one year. It also includes hundreds of new functions, usability improvements, bugfixes, and other goodies. See the relevant changelogs for a good sampling of all the new features that have gone into version 3.4
Most plugins have been either migrated or incorporated into the core QGIS code base.
We strongly discourage the continued use of QGIS 2.18 LTR as it is now officially unsupported, which means we’ll not provide any bug fix releases for it.
You should also note that we intend to close all bug tickets referring to the now obsolete LTR version. Original reporters will receive a notification of the ticket closure and are encouraged to check whether the issue persists in the new LTR, in which case they should reopen the ticket.
If you would like to better understand the QGIS release roadmap, check out our roadmap page! It outlines the schedule for upcoming releases and will help you plan your deployment of QGIS into an operational environment.
The development of QGIS 3.4 LTR has been made possible by the work of hundreds of volunteers, by the investments of companies, professionals, and administrations, and by continuous donations and financial support from many of you. We sincerely thank you all and encourage you to collaborate and support the project even more, for the long term improvement and sustainability of the QGIS project.