Bug report #18927

Insert new record in form with one to many relation try to save sequence as string

Added by Luca Lanteri over 2 years ago.

Status:Open
Priority:Normal
Assignee:-
Category:Forms
Affected QGIS version:3.1(master) Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:26759

Description

I have 2 tables postgres in relation one to many among them, connected with the classic fkey. I created a form that contains both tables using relationships. If I create a new parent and also a child record, qgis fails to save the child because it tries to assign the string value to "nextval ('gid_seq'::regclass), since the parent's primary key has not yet been assigned". In practice I am forced first to save the father (exiting the form) and only then create the child record. At the moment I solved using a uuid field as fkey but it's just a patch, not the behavior I would expect in a form.

test.backup - Postgres backup (4.66 KB) Luca Lanteri, 2018-05-08 04:46 PM

test.qgs - QGIS Project (21.9 KB) Luca Lanteri, 2018-05-08 04:47 PM

Also available in: Atom PDF