Bug report #8145

Field calculator does not work when creating new PostGIS real and double columns

Added by Giovanni Manghi about 6 years ago. Updated about 6 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Jürgen Fischer
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 #:16973

Description

When computing a new column of type real or double, it seems that is ok, but after saving edits and closing/reopening the column this is filled with just nulls.

Updating the new column works fine.

Numeric and decimal types are not affected.

Works ok on 1.8

postgis_fc.mp4 (4.27 MB) Giovanni Manghi, 2013-06-29 02:50 AM


Related issues

Related to QGIS Application - Bug report #8235: Attribute will be NULL, after using field calculator at a... Closed 2013-07-08

Associated revisions

Revision f2031053
Added by Jürgen Fischer about 6 years ago

postgres provider: set length and precision of native floating point types to -1 (fixes #8145)

History

#1 Updated by Matthias Kuhn about 6 years ago

  • Status changed from Open to Feedback

Unable to reproduce using the field calculator. Can you provide more detailed instructions please.

#2 Updated by Giovanni Manghi about 6 years ago

Matthias Kuhn wrote:

Unable to reproduce using the field calculator. Can you provide more detailed instructions please.

see attached screencast

#3 Updated by Salvatore Larosa about 6 years ago

confirmed here !

#4 Updated by Matthias Kuhn about 6 years ago

I can reproduce it now. I don't know what the problem was before.

#5 Updated by Matthias Kuhn about 6 years ago

  • Assignee set to Jürgen Fischer

The problem is, that the postgres provider assigns -1 / 0 to field size / field precision differently that they are assigned in the NativeTypes (it's 0 as default argument there)

When committing, the fields from the vector layer and the newly created provider fields are compared and the process is aborted because they don't seem to be equal.
It's similar to 0b780b0a

Jef: I'll leave it to you to decide if the postgres provider or the QgsField::operator== should be adjusted.

#6 Updated by Jürgen Fischer about 6 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF