[Qgis-user] Qgis // "string_to_array" fonction not working: NULL values

celati Laurent laurent.celati at gmail.com
Wed Sep 17 04:04:20 PDT 2025


Dear all,
I work wth Qgis and postgis.
With PostGIS, I ran an SQL script that contains a section dedicated to
aggregation geoprocessing: from multiple source data, each containing a
unique ID, this allows to retrieve an aggregation of the IDs for each
polygon overlap/overlay in a column of a new "result" table:
Below is an extract from the script:

    array_agg(l.id_unique) as data_id_ori


Regarding this PostGIS table, the output column is of type bingint[] when I
check properties thanks to pgadmin interface.
Below i paste an extract of the result:

    |                                     |
    |   data_id_ori                 |
    --------------------------       |
    | 27, 26, 17, 6, 1, 2, 15   |
    |                                     |
    |                                     |



Now, with QGIS, when i try to query on this column, for example to select
only a slection of features (data_id_ori = 1), QGIS selects the values 1
but also the numbers 1 making up 17, 15, etc. This limitation comes from
QGIS: the problem is that the postgis integer array is represented/read as
text by Qgis. QGIS doesn't recognize/read this field as an array of numbers.

So i tried using the Qgis "string_to_array function", which allows you to
transform an array represented by text towards a "real" numeric array. But
during my attempts, I only get NULL values for the output. When using the
string_to_array function, should the output field type be integer, float,
or other?

Thanks so much for your guidances  / help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20250917/505db284/attachment.htm>


More information about the QGIS-User mailing list