Bug report #20067
Duplicate feature action fails with PostgreSQL error message
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | David Signer | ||
Category: | Actions | ||
Affected QGIS version: | 3.3(master) | Regression?: | Yes |
Operating System: | any | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 27889 |
Description
The Duplicate feature action that is available from the Actions menu of a feature form is currently broken in QGIS 3.2 and QGIS master. It still work fine in QGIS 3.0.x
The issues might be specific to my project and data structure.
The affected column that causes issues also has a default value attached, that is created by a custom Python expression.
In version 3.2.x nothing happens when trying to digitize the duplicate, in 3.3x there is the following error message:
CRITICAL: Layer EWS_Anlage: PostGIS-Fehler beim Attributhinzufügen: ERROR: value too long for type character varying(7).
However, the values that are generated by the custom python expression function are exactly 7 characters long.
Could it be that in 3.2 and master it is trying to commit the expression code instead of the expression result for default values?
David should have our project file and DB structure, but I can submit it to others on request.
Thanks!
Associated revisions
right order of priorities
by getting the value - if it's unique, first getting the defaults before creating an unique value.
Fix #20067
History
#1 Updated by Andreas Neumann about 6 years ago
The concerned column is most likely the one named "anlage_nr" with the following definition:
anlage_nr character varying(7) COLLATE pg_catalog."default" NOT NULL,
#2 Updated by David Signer about 6 years ago
- Assignee set to David Signer
#3 Updated by David Signer about 6 years ago
I've been able to reproduce.
Your expression:get_ews_anlage_gemeinde_formatted() || '.' || get_ews_anlage_nr( get_ews_anlage_gemeinde_formatted() )
is displayed as invalid on my build. Not sure how it is on the 3.0.x - can you check?
Has there been a change in the call of the functions like e.g. with an @
?
#4 Updated by David Signer about 6 years ago
Just seen another thing. Could it be that an error is given back and then the error message is tried to write into the field?
But I'll continue research...
#5 Updated by David Signer about 6 years ago
fyi:
Found the error. It's because it creates a value like "03.0108_1" in createUniqueValue
called by createFeature
instead of creating a new default value by expression.
#6 Updated by Andreas Neumann about 6 years ago
Good catch - thanks!
In 3.0 this still worked fine. So something in 3.2 or master introduced this problem.
Can you fix that?
Many thanks and have a nice weekend?
#7 Updated by David Signer about 6 years ago
Yes I will fix it. But I have to continue on Monday. Hope you don't mind.
#8 Updated by Andreas Neumann about 6 years ago
that's fine - thanks!
#9 Updated by David Signer about 6 years ago
- % Done changed from 0 to 100
- Status changed from Open to Closed
Applied in changeset qgis|d26848e97746ccab3a8ac5c0a9cc56db63e34501.