<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi,</p>
<p>I have a PostgreSQL table with columns of type array (like int4[4] or text[]).</p>
<p>Now I have issues in QGIS when trying to save a QGIS array to this PostgreSQL array.</p>
<p>Arrays in QGIS use a square bracket notation, array in PostgreSQL use a curly braces notation.</p>
<p>Now if I try to save a QGIS array (result of an expression) to this PostgreSQL array column, it fails.</p>
<p>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 <a href="https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/vector_properties.html#edit-widgets">https://docs.qgis.org/testing/en/docs/user_manual/working_with_vector/vector_properties.html#edit-widgets</a> ).</p>
<p>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.</p>
<p>Here is what I tried:</p>
<p><span style="font-family: courier new, courier, monospace;">overlay_intersects(layer:='AV Gemeindegrenze', expression:=bfs_nr)</span><br /><span style="font-family: courier new, courier, monospace;"> --> returns, f.e. [2555,2554] as a QGIS array</span></p>
<p>and</p>
<p>'{' || array_to_string(overlay_intersects(layer:='AV Gemeindegrenze', expression:=bfs_nr)) || '}'<br />--> returns, f.e. {2555,2554} as a string</p>
<p><br /></p>
<p>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).</p>
<p>Thank you for your help!</p>
<p>Andreas</p>
<p><br /></p>

</body></html>