Bug report #9008
Postgis: commit errors leads to loosing data
|Affected QGIS version:||2.0.1||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 #:||17663|
When editing data in attribute view, if commit is raising error, there is no way to save pending edits.
More precisely, two cumulated problems:
- when trying to edit text longer than column type (character varying 150, typing 200 character values), commits raise error. Every other software raises a warning and then truncate values to max possible length.
- editing in full screen attribute view, soft error bar is not show (they raise in main window), then 8 save actions where logged in error, but I didn't see them from the attribute view, I lost 2 hours work on a field. Saving pending edits in another format is not possible, since qgis reads datasource when exporting, and not in memory edits. The only way I could have save my work was using a copy-paste action to a spreadsheet.
RESULT: When should find a way to show errors logs on save in attribute view also. Provider should try to truncate the values to the size of field. I one value is too long, the whole table can't be saved!
#2 Updated by Jürgen Fischer almost 8 years ago
If the provider is capabable to determine a maximum length, QGIS should already not allow to enter more data. And if it can't, it cannot truncate the field to the allowed size either (and it IMHO shouldn't anyway. I also doubt that every other software would do so). QGIS also doesn't discard pending changes that cannot be saved unless you tell it to. You still can update your edits to make them fit and save them, but I admit that it can be hard to know which changes are actually the problem.
And QGIS should still use the changed data while the edits are not committed, so "Save as..." should have been possible.