Bug report #7437

changeAttributeValue: decimal values are not written if not rounded

Added by Denis Rouzaud over 11 years ago. Updated over 11 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:16398

Description

Via python, I try to update layer decimal values using
vectorLayer.changeAttributeValue
and
vectorLayer.dataProvider().changeAttributeValues

My field in postgres is type decimal(10,3).
If not priory rounded, a value is written as 0 and both methods return true.

History

#1 Updated by Denis Rouzaud over 11 years ago

Also, I tried with or without QVariant, it does not change anything:
vectorLayer.changeAttributeValue( f.id(), fieldIdx, value )
vectorLayer.changeAttributeValue( f.id(), fieldIdx, QVariant(value) )

#2 Updated by Denis Rouzaud over 11 years ago

  • Status changed from Open to Closed

my fault, my value was of type numpy.float64, and it QVariant can't convert it to float.

Also available in: Atom PDF