Skip to content
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

QGIS expression builder can not resolve PostgreSQL text arrays correctly #45290

Closed
2 tasks
eurojam opened this issue Sep 28, 2021 · 4 comments · Fixed by #45321
Closed
2 tasks

QGIS expression builder can not resolve PostgreSQL text arrays correctly #45290

eurojam opened this issue Sep 28, 2021 · 4 comments · Fixed by #45321
Assignees
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions

Comments

@eurojam
Copy link

eurojam commented Sep 28, 2021

What is the bug or the crash?

I have a PostGIS layer which contains text arrays. At the moment it is not possible to use field values resolved by the expression builder. If the array contains only one item, the field value will be ok, having two or more values within the array, the field value preview returns an empty string
2021-09-28 10_12_12-_edg — QGIS  English
g.

Steps to reproduce the issue

  1. load postgis layer containing text array fields
  2. select by expression
  3. fields and values
  4. values->all unique->only show values in use
  5. select entry with two or more values in the array
  6. returns an empty string/array

Versions

<style type="text/css"> p, li { white-space: pre-wrap; } </style>
QGIS-Version 3.20.3-Odense QGIS-Codeversion 495fbae
Qt-Version 5.15.2
Python-Version 3.9.5
GDAL-Version 3.3.1
PROJ-Version 8.1.1
EPSG-Registraturdatenbankversion v10.028 (2021-07-07)
GEOS-Version 3.9.1-CAPI-1.14.2
SQLite-Version 3.35.2
PDAL-Versio 2.3.0
PostgreSQL-Client-Version 13.0
SpatiaLite-Version 5.0.1
QWT-Version 6.1.3
QScintilla2-Version 2.11.5
BS-Version Windows 10 Version 2009
       
Aktive Python-Erweiterungen active_layer_searchGeoCodingpluginbuilder3plugin_reloaderQNEAT3db_managerMetaSearchprocessing

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

  • I tried with a new QGIS profile

Additional context

version
PostgreSQL 11.12 (Debian 11.12-0+deb10u1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit
postgis_version 2.5 USE_GEOS=1 USE_PROJ=1 USE_STATS=1

@eurojam eurojam added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Sep 28, 2021
@gioman gioman added the Expressions Related to the QGIS expression engine or specific expression functions label Sep 28, 2021
@eurojam
Copy link
Author

eurojam commented Sep 28, 2021

Helpful would be an expression type like "Fieldname" @> ARRAY['A', 'B'] which is possible in the filtering of layers with provider specific filter expressions

@troopa81 troopa81 self-assigned this Sep 29, 2021
@troopa81
Copy link
Contributor

@eurojam Could you tell me how you define and insert your array values ?

Even the label inside list are empty when I test with this data:

create table text_array ( id serial primary key, thetext character varying[] );
insert into text_array (thetext) values(array['C', 'D', 'E'])

@troopa81
Copy link
Contributor

@eurojam Nevermind I suppose you have define the List widget type in the attribute forms properties

@eurojam
Copy link
Author

eurojam commented Sep 29, 2021

No we didn't use the listwidget, we used a value relation widget with the multiple selection option:

1_a
)
1_b

2021-09-29 10_17_52-Layer Properties — sae_test — Attributes Form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants