Bug report #4766
Missing warnings when inserting wrong values into Attribute Table
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Data Provider | ||
Affected QGIS version: | master | 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 #: | 14629 |
Description
To reproduce this issue, try the following:
In editing mode, use field calculator to add a new Integer field with width = 1 and fill it with the value 100.
This is obviously not going to work because we would need at least a width of 3 to accommodate this value.
Instead, '100' is happily displayed in the attribute table.
Only when I deactivate editing mode, the value suddenly gets truncated and reads '1' now.
In this simple case it's easy to spot. In other cases this can severely throw users off their path.
There should be some kind of warning.
Related issues
History
#1 Updated by Maxim Dubinin almost 13 years ago
+1
This is very confusing especially for new users. Here is another test case:
1. Create a real field with 12 digits without decimals
2. Try to enter a value of lets say 1234567890123
3. Seemingly values enters ok.
4. After saving it changes to overflow -2147483648
Whatever the logic behind it, it should better warn the user not letting him enter such value instead of giving cryptic answer.
#2 Updated by Alexander Bruy over 12 years ago
See also #4955
#3 Updated by Paolo Cavallini about 12 years ago
- Target version changed from Version 1.8.0 to Version 2.0.0
#4 Updated by Jürgen Fischer over 10 years ago
- Target version changed from Version 2.0.0 to Future Release - Lower Priority
#5 Updated by Anita Graser about 9 years ago
When trying to reproduce this, I now found that the values are not truncated anymore.
That means: I can store values like 100 in an integer field with length 1 ...
#6 Updated by Giovanni Manghi over 7 years ago
- Regression? set to No
- Easy fix? set to No
#7 Updated by Giovanni Manghi over 5 years ago
- Status changed from Open to Closed
- Resolution set to end of life
End of life notice: QGIS 2.18 LTR
Source:
http://blog.qgis.org/2019/03/09/end-of-life-notice-qgis-2-18-ltr/
#8 Updated by Anita Graser over 5 years ago
- Description updated (diff)
I've tested this using Shapefiles in 3.7: for integer fields, the length doesn't seem to matter. There is no warning but the values also aren't truncated. For decimal numbers, the attribute table now prevents inserting invalid values.
#9 Updated by Anita Graser over 5 years ago
- Resolution changed from end of life to fixed/implemented