Hi,

I have a PostgreSQL table with columns of type array (like int4[4] or text[]).

Now I have issues in QGIS when trying to save a QGIS array to this PostgreSQL array.

Arrays in QGIS use a square bracket notation, array in PostgreSQL use a curly braces notation.

Now if I try to save a QGIS array (result of an expression) to this PostgreSQL array column, it fails.

If I formulate the expression such, that the array starts/ends with curly braces, I can save the array in PostgreSQL, but it wouldn't load in the "list" widget, which is supposed to work with an array. The documentation claims "List: Displays a single column table to add different values within a single field. This is currently supported by the PostgreSQL provider, for fields of array type." (from https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/vector_properties.html#edit-widgets ).

Does someone know how I can properly populate a "list widget" with an array, or at least make the array work properly with at "Text" widget? The latter would also be acceptable, but the list widget would be nicer.

Here is what I tried:

overlay_intersects(layer:='AV Gemeindegrenze', expression:=bfs_nr)
 --> returns, f.e. [2555,2554] as a QGIS array

and

'{' || array_to_string(overlay_intersects(layer:='AV Gemeindegrenze', expression:=bfs_nr)) || '}'
--> returns, f.e. {2555,2554} as a string

Neither way works properly. The latter way let's me at least save the data in PostgreSQL, but it wouldn't display correctly in QGIS (tried LIST and Text widget).

Thank you for your help!

Andreas
_______________________________________________
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to