Bug report #933
a string instead of a number in digitiser and table editor is not handled
|Affected QGIS version:||Regression?:||No|
|Operating System:||Debian||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||10992|
Digitising, PostGIS case:
1. Digitise a feature in PostGIS layer entering a string in a numeric column (human error). Press OK. QGIS accepts this. It shouldn't.
2. Digitise a few more, no errors. Say it took you half an hour. Toggle editing off, save changes. An error pops up:
ERROR: invalid input syntax for integer: "the string you entered in error instead of number"
You can't save changes. Beacause of one un-handled error all digitising has to be re-done.
Table editing, PostGIS case:
1. Add a PostGIS layer which has a numeric field.
2. In table editor "Start editing", enter a string instead of number in one row (human error). QGIS allows this - it shouldn't. Edit several other (correctly this time). Stop editing, save - error:
The [[PostgreSQL]] database returned: ERROR: invalid input syntax for integer: "huha" When trying: UPDATE "public"."layer1" SET huha='huha' WHERE "gid"=
Again, you can't save changes. Beacause of one un-handled error editing has to be re-done.
Digitising, shapefile case:
1. Digitise a feature in a shapefile layer entering a string in a numeric column (human error). Press OK. QGIS accepts this. It shouldn't.
2. Digitise a few more, not making errors. Toggle editing off, save changes. Saved OK. Check the table - the row where you made an error is "0". This is not correct to silently force an arbitrary value when a string instead of number is given. The error should handled.
Editing table, shapefile case:
QGIS behaves the same like described above - forces an arbitrary value when a string instead of number is given, which is not right.
#1 Updated by Maciej Sieczka - almost 13 years ago
After some recent Jurgen's fixes it is now possible to correct an invalid field that prevents comitting changes, during digitizing, in the table editor, in case of PostGIS layers. So it is not that bad now for PostGIS.
However, the silent data corruption in case of editing Shapefiles still takes place, as described above.