Bug report #21896

Attribute Form keeping settings after column deletion

Added by Jonathan Moules almost 5 years ago. Updated almost 5 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Attribute table
Affected QGIS version:3.4.3 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:29711

Description

To replicate (GeoPackage):

1) Create a field (MY_FIELD in this) of type whole integer:
2) For Layer Properties -> Attributes Form set Default value to 0; Apply on Update to MY_FIELD.
3) Delete the field (MY_FIELD)
4) Create a new field with the same name (MY_FIELD)
5) Look in Layer Properties -> Attributes Form. it will have the same setting as was set for the previous field of the same name (there should be no default on the new layer).
Worse - the values in the new field will NOT have used this default - they'll all (correctly) be NULL, not 0.

History

#1 Updated by Giovanni Manghi almost 5 years ago

  • Status changed from Open to Feedback

Jonathan Moules wrote:

To replicate (GeoPackage):

1) Create a field (MY_FIELD in this) of type whole integer:
2) For Layer Properties -> Attributes Form set Default value to 0; Apply on Update to MY_FIELD.
3) Delete the field (MY_FIELD)

no "save" of changes in between 3 and 4?

Worse - the values in the new field will NOT have used this default - they'll all (correctly) be NULL, not 0.

regardless of the above or only if the above steps are followed?

#2 Updated by Jonathan Moules almost 5 years ago

  • Status changed from Feedback to Open

- Saving between steps makes no difference.

- I honestly have no idea how the "default" function is meant to work. Even after step (2) the value in my field is NULL despite having now set a default value. You can't set a default value on a column at column creation time, so how do you actually set a default without ticking the "Apply on Update" and then updating the column (likely by setting the value to itself)?

Also available in: Atom PDF