Bug report #15614
Error when adding integer field to an existing geopackage
|Affected QGIS version:||2.16.3||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||fixed/implemented|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||23537|
There is a problem when adding an integer field to an existing geopackage. Here are some steps to reproduce the bug:
1. Create a new geopackage
2. Start editing and create a new empty integer field using the "New field" button (attribute table)
3. Stop editing and try to save changes, I get the following error message:
Could not commit changes to layer testshape
Errors: SUCCESS: 1 attribute(s) added.
ERROR: field with index 2 is not the same!
expected field: name=test type=int typeName=integer len=1 precision=0
retrieved field: name=test type=int typeName=Integer len=0 precision=0
#3 Updated by Even Rouault almost 4 years ago
- Resolution set to fixed/implemented
- Target version set to Version 2.14
- Assignee set to Even Rouault
- Category set to Data Provider/OGR
This was due to the create field dialog asking to create fields with width 1, whereas the GPKG driver doesn't support field width for non-text field, and the QgsVectorLayerEditBuffer class checking that the created field has the asked width.