Bug report #21895
Updated by Jürgen Fischer over 5 years ago
While trying to work around #21892 https://issues.qgis.org/issues/21892 I encountered the following.
To replicate (in a GeoPackage - probably not format specific):
1) Create a new field of type Integer called whatever (_MY_FIELD here)
2) Use the Layer Properties -> Attributes Form to set a default value of 0 on _MY_FIELD, and tick the "Apply default on update" (this is the bug!)
3) Now, use expression calculator to UPDATE _MY_FIELD with any numerical value (fid will do).
Result = _MY_FIELD only has values of "0".
If you uncheck the "Apply default on update" then the update of the field will work as expected.
To replicate (in a GeoPackage - probably not format specific):
1) Create a new field of type Integer called whatever (_MY_FIELD here)
2) Use the Layer Properties -> Attributes Form to set a default value of 0 on _MY_FIELD, and tick the "Apply default on update" (this is the bug!)
3) Now, use expression calculator to UPDATE _MY_FIELD with any numerical value (fid will do).
Result = _MY_FIELD only has values of "0".
If you uncheck the "Apply default on update" then the update of the field will work as expected.