-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
a feature copy/paste sets a NULL field to its "default value" in a geopackage #44544
Comments
@faridcher this version is EOL, you must test on 3.16 or 3.20
@faridcher are you copying/pasting within the same layer or between different ones? |
This comment has been minimized.
This comment has been minimized.
@faridcher 3.16 is the stable version, 3.10 is EOL. |
This comment has been minimized.
This comment has been minimized.
@faridcher could not, but you could attach a sample layer for examples, so we can test on the same data. |
@faridcher works fine here on a PostGIS layer on QGIS master on Ubuntu 20.04. |
This comment has been minimized.
This comment has been minimized.
@faridcher another bug, another ticket ;) |
@faridcher yes confirmed. |
@faridcher what field in your sample? |
This comment has been minimized.
This comment has been minimized.
@faridcher that is an effect of the "boolean" widget, if you set the edit widget to "text edit" you'll see the NULL value. |
This comment has been minimized.
This comment has been minimized.
@faridcher yes makes sense, anyway file a separate ticket please. |
@gioman Could you please hide all of the outdated comments to keep the issue tidy for the prospective bug hunter? I updated the question to reflect the outcome of our discussion. thank you |
@faridcher It's because you have defined a default value in your attribute form appartement configuration. So when you copy the feature, appartement attribute is NULL, so QGIS considers it has to use the defined default value. You could possibily argue that is not the expected behavior and the new feature should be identical to the copied one, but maybe other users would expect to use the default value on a NULL field. I think I would favor the first one. It looks like it has been the matter of debate. @m-kuhn @elpaso Do you remember what was the outcome of the discussion about that? I can propose a fix, if we agree that we don't evaluate default value when user copy-paste feature |
That would be a very bad idea -- default values are used in workflows to do things like set a "feature created" field, which MUST be done when pasting features. |
The discussion there was different "if qgis default value returns null should we fallback to provider default value".
Does that work? If there is a feature with a |
@Troopa I also favor the first one. As the name implies (copy/paste), the target feature in the target layer should be as similar as possible to the source feature even its Disabling the default values expression altogether might preclude @m-kuhn described scenario (pasting across layers):
So the ultimate solution could be: upon paste, evaluate all default values (only when pasting across layers) and then paste all attributes including NULLs from the source feature in the source layer. @Troopa thank you for looking at this. |
What is the bug or the crash?
A feature copy and paste should also carry over all attributes value but the process sets a NULL field value to its default value which is set in its layer Attribute Form.
Steps to reproduce the issue
use the sample
labs
layer and itsapartment
field as a basis; its widget type is set to Checkbox and its default value totrue
(Layer properties-Attribute Form). Use the only feature in the layer withapartment=NULL
. Copy and paste this feature to observe that the apartment field value of the new feature is set totrue
instead ofNULL
.Versions
Qgis 3.16.8
@gioman also tested with master
Additional context
sample geopackage data: test.zip
@gioman could not not replicate with a PostGIS layer.
The text was updated successfully, but these errors were encountered: