Bug report #4766

Missing warnings when inserting wrong values into Attribute Table

Added by Anita Graser over 12 years ago. Updated about 5 years ago.

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

Duplicated by QGIS Application - Bug report #4955: Wrong results, when calculated results are too long for D... Closed 2012-02-07

History

#1 Updated by Maxim Dubinin about 12 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 about 12 years ago

See also #4955

#3 Updated by Paolo Cavallini over 11 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#4 Updated by Jürgen Fischer almost 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#5 Updated by Anita Graser over 8 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 almost 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#7 Updated by Giovanni Manghi about 5 years ago

  • Status changed from Open to Closed
  • Resolution set to end of life

#8 Updated by Anita Graser about 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 about 5 years ago

  • Resolution changed from end of life to fixed/implemented

Also available in: Atom PDF