Bug report #5173

Shape file field precision includes the . when saving, but not when editing in the attribute table

Added by Alister Hood almost 12 years ago. Updated about 8 years ago.

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 #:14920


e.g. if an attribute field in a shapefile has precision = 2, when I edit it I can input values like 2.12, but when I save the layer this is rounded to 2.1

Note: I am using GDAL 1.9.0 if that is relevant.

Related issues

Related to QGIS Application - Feature request #5546: Add a warning when vector fields/values are above the limits Open 2012-05-07
Related to QGIS Application - Bug report #14019: Problems with a field where precision = length Closed 2015-12-20


#1 Updated by Paolo Cavallini over 11 years ago

  • Target version set to Version 2.0.0

#2 Updated by Alister Hood over 11 years ago

Also see comment by Christine at #5546

#3 Updated by Jürgen Fischer over 9 years ago

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

#4 Updated by Médéric RIBREUX about 8 years ago

  • Status changed from Open to Feedback

Hello, bug triage...

I can't reproduce it on QGIS 2.13 master (have set a decimal field of size 3 and precision 2).

Can you confirm this ?

#5 Updated by Alister Hood about 8 years ago

Yes, it is pretty much fixed.
There is a problem with a corner case which would perhaps be best filed as a new issue:

A) QGIS allows me to create a column with precision = length. I'm not sure if this itself is a bug, but it then behaves strangely with that column.
B) if I create a field with precision = length = 2 I can save either three digits before the decimal point or two after it (is this a bug or a feature of the shapefile format? Perhaps it is related to Christine's comment at #5546)
C) but the gui lets me put in a lot more digits both before and after the decimal point.
D) and even if I save the edit I can't see the "rounding" that occurs unless I reopen the attribute table.

#6 Updated by Giovanni Manghi about 8 years ago

  • Status changed from Feedback to Closed
  • Resolution set to fixed/implemented

Alister Hood wrote:

Yes, it is pretty much fixed.
There is a problem with a corner case which would perhaps be best filed as a new issue

yes please, thanks!

Also available in: Atom PDF