Bug report #20397

QGIS 3.4 Incorrect handling of Postgres serial columns

Added by Scott Werkema almost 2 years ago. Updated almost 2 years ago.

Status:Closed
Priority:High
Assignee:-
Category:Data Provider/PostGIS
Affected QGIS version:3.4.0 Regression?:Yes
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:28217

Description

Starting with QGIS 3.4, I am unable to digitize multiple features between saves for PostGIS layers with a serial column that has a unique constraint. It appears the serial column's default text is triggering QGIS unique constraint enforcement.

Note: In the attached screenshot, `structure_id` is the primary key column.

Screen Shot 2018-11-07 at 09.27.29.png - Error when digitizing second feature in edit session (63.1 KB) Scott Werkema, 2018-11-07 04:52 PM


Related issues

Related to QGIS Application - Bug report #20431: no possibility to confirm in the attribut form while add ... Closed 2018-11-09

Associated revisions

Revision 32b7d7e5
Added by David Signer almost 2 years ago

check uniqueCheck before overwrite defaultValueClause

and some tests for it
this fixes #20397 and fixes #20431

Revision 76667eee
Added by David Signer almost 2 years ago

check uniqueCheck before overwrite defaultValueClause

and some tests for it
this fixes #20397 and fixes #20431

(cherry-picked from 32b7d7e5ddeef7a66592267819e234085c44a7bc)

History

#1 Updated by Giovanni Manghi almost 2 years ago

  • Priority changed from Normal to High
  • Operating System deleted (macOS 10.14.1)

#2 Updated by Burghardt Scholle almost 2 years ago

I can confirm your description with QGIS DEV code revision 7cce9b3eb9. After digitizing a new feature I have to save first before I can continue with the next feature. Otherwise I get the same error message in the PostGIS-Tab of the log:

2018-11-16T09:53:49 WARNING Query: DECLARE qgis_1774 BINARY CURSOR FOR SELECT "gid","datum"::text,"bearbeiter"::text,"veranstaltung"::text,"beschriftung"::text,"name"::text,"flaechentyp"::text,"farbe"::text,"schraff_width"::text,"schraff_width_prt"::text,"schraff_size"::text,"schraff_size_prt"::text,"schraff_winkel"::text,"umrissfarbe"::text,"umrisstyp"::text,"umrissstaerke"::text,"umrissstaerke_prt"::text,"umfang"::text,"flaeche"::text,"bemerkung"::text,"last_change"::text FROM "geofachdaten"."gis_digi_a_geo" WHERE ("gid" = 'nextval(''gis_digi_a_geo_gid_seq''::regclass)') LIMIT 1 returned 7 [ERROR: invalid input syntax for integer: »nextval('gis_digi_a_geo_gid_seq'::regclass)«
LINE 1: ...OM "geofachdaten"."gis_digi_a_geo" WHERE ("gid" = 'nextval('...

This significantly impairs the workflow during digitization.

#3 Updated by Harrissou Santanna almost 2 years ago

What happens if "evaluate default values on provider side" is checked in the project settings, as suggested in #20431?

#4 Updated by Jan Lippmann almost 2 years ago

see also here #20431

when you hide the serial field in the form you can add more than one feature without save each feature

BUT then you can run into this issue: #20433

#5 Updated by Harrissou Santanna almost 2 years ago

  • Related to Bug report #20431: no possibility to confirm in the attribut form while add more than one feature (postgres) added

#7 Updated by David Signer almost 2 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

Also available in: Atom PDF