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

Value Map Widget NULL value breaks for text field shorter than 38 characters #59368

Open
2 tasks done
esnyder-rve opened this issue Nov 7, 2024 · 5 comments · May be fixed by #60801
Open
2 tasks done

Value Map Widget NULL value breaks for text field shorter than 38 characters #59368

esnyder-rve opened this issue Nov 7, 2024 · 5 comments · May be fixed by #60801
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Forms Regression Something which used to work, but doesn't anymore Widgets

Comments

@esnyder-rve
Copy link
Contributor

What is the bug or the crash?

For some reason, the NULL value is not retained correctly (see steps for more details).
What's odd is that this is not consistent. Some attributes don't have this issue, others do.
My data is stored in a PostGIS table, where the field is allowed to be NULL (I checked).
When running a SELECT DISTINCT the resulting values are correct (with NULL showing as NULL, and not what garbage QGIS is showing).
image

However, QGIS is insisting that the value is that uuid string as shown here when the value map widget is setup (it should be NULL):
image

Steps to reproduce the issue

  1. Add a layer (in my case is a PostGIS layer)
  2. Go to the Attributes Form settings
  3. Set an attribute's widget type to "Value Map"
  4. Add "NULL" value (looks correct at this point)
    image
  5. Click "Apply"
  6. Navigate away (by any means) to something else in the UI (such as choosing another attribute)
  7. Go back to the original attribute and find this
    image

Versions

QGIS version 3.40.0-Bratislava
QGIS code revision b56115d
Libraries
Qt version 5.15.13
Python version 3.12.7
GDAL/OGR version 3.9.3
PROJ version 9.5.0
EPSG Registry database version v11.016 (2024-08-31)
GEOS version 3.13.0-CAPI-1.19.0
SQLite version 3.46.1
PDAL version 2.8.1
PostgreSQL client version unknown
SpatiaLite version 5.1.0
QWT version 6.3.0
QScintilla2 version 2.14.1
OS version Windows 10 Version 2009
Active Python plugins
db_manager 0.1.20
grassprovider 2.12.99
MetaSearch 0.3.6
processing 2.12.99

Supported QGIS version

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

New profile

Additional context

At first, I thought it displayed the first value of the Display field for the layer (like how the expression editor shows for the feature preview). However, when I change the display field, this garbage value does not change when deleting and re-adding the NULL option.

@esnyder-rve esnyder-rve added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Nov 7, 2024
@esnyder-rve esnyder-rve changed the title "NULL" value in Attribute Form Value Map Widget displays as other field value Value Map Widget NULL value breaks for text field shorter than 38 characters Nov 7, 2024
@esnyder-rve
Copy link
Contributor Author

Found the issue.
I made a memory layer with text fields of various lengths and got this issue:

Field Length Issue?
A 254 No
B 128 No
C 64 No
D 32 Yes
E 38 No
F 37 Yes

Steps to Reproduce:

  1. Create a memory layer
  2. Add a text field with >=38 length
  3. Add a text field with <38 length
  4. Go to the Attributes Form and set each to Value Map, and add a NULL option
  5. Issue will show for the second (<38 length) field

@esnyder-rve
Copy link
Contributor Author

This issue is not present in the current LTR version.

@agiudiceandrea agiudiceandrea added Widgets Regression Something which used to work, but doesn't anymore labels Nov 8, 2024
@agiudiceandrea
Copy link
Member

@esnyder-rve, thanks for reporting. The provided steps are enough to replicate the issue even using QGIS 3.38. The issue occurs using QGIS >= 3.38, while it doesn't occur using QGIS <= 3.36.

Hi @elpaso, may you have a look at this? Is it possible that the issue may have been triggered by #57690?

@agiudiceandrea
Copy link
Member

@elpaso, have you had a chance to look at this issue?

@agiudiceandrea
Copy link
Member

See #60801.

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! Forms Regression Something which used to work, but doesn't anymore Widgets
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants