-
-
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
Populating a column of type PostgreSQL array and list widget with an expression fails if "Apply default value on update" is enabled #46158
Comments
Interestingly, this works for me with QGIS master, the postgis layer (created with the SQL in the issue description) and a simple scratch layer that corresponds to Attached you find a gpkg project and a .qgs project (if you want to edit the XML before loading) |
Confirmed - with your project it works, with my project not. Now I have to dig in to find what the differences are ... Let's keep the ticket open until it also works in my projects. I will add more info. |
Ok - this is really weird. If you rename the attribute "x" in layer "array_test" it starts failing. It would still display in the "Identify Results" panel correctly, but not in the list widgets. Perhaps QGIS doesn't like it if both layers have the same attribute name? |
when they are created in the attribute dialog Fixes qgis#46158
when they are created in the attribute dialog Fixes qgis#46158
Fix pending in #46172 FYI, the default value expression needs to return an array (not a string representation of an array), the fix is in the update of the default value on the attribute dialog, specific for "apply on update" and will work for any datatype that is not trivially convertible to string and back (like arrays here, but could also be geometry, date, ...). |
when they are created in the attribute dialog Fixes qgis#46158
when they are created in the attribute dialog Fixes #46158
What is the bug or the crash?
The setup contains a PostgreSQL table where one or more columns are of type array (array of int4 or array of string).
The associated widget should be a "list widget" and the list should be populated with an "overlay_intersects()" expression function as a default value:
The problem is that I cannot populate the list widget with the QGIS expression. The list always stays empty, even if I can see a correct preview that shows that the expression works.
I tried the following three expressions:
Neither of the three expressions was able to populate the list widget, even if the preview always contained correct data.
Note: PostgreSQL arrays use curly brackets ( {} ) while QGIS arrays use square brackets ( [] ).
Steps to reproduce the issue
Dataset to test against (Geopackage) - for the overlay_intersects() expression:
hoheitsgrenzen_gemeindegrenze.gpkg.zip
.
Versions
<style type="text/css"> p, li { white-space: pre-wrap; } </style>Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: