We have a QGIS project with a parent (parquets) and two child layers (peuplements and gestion) (1:n relation) all stored in PostGIS. The parent primary key is a UUID (no default value defined). Both child layers use an UUID field as foreign key. Foreign key constraints are set properly in PostGIS.
In QGIS relations are set and the parent uuid has an uuid() function in the attribute field set as default. (We do not use the built-in UUID-generator.)
In QGIS we can digitize new parent polygons, add multiple children and save everything back to the database.
When using the project in QField we are able to digitize new polygons and add child layers. When trying to sync back to QGIS only the parent polygons are imported and we run in the following error:
insert or update on table "parquets" violates foreign key constraint "peuplement_fk" DETAIL: Key (uuid)=(24fdfc80-2f1e-44fb-8dd8-d492901c37de) is not present in table "parquets".
This behavior is correct. When I look in the attribute table of the parent layer in PostGIS, all the UUIDs are new ones. So none of the children can be imported since they all keep the old UUIDs from QField.
Did we miss something?
QGIS 3.16.7
QField 1.9.5 (5f66b7v1.9.5)
insert or update on table "gestion" violates foreign key constraint "gestion_fk" DETAIL: Key (uid)=(51ccac98-a32d-41c2-b9b3-c4beed1327da) is not present in table "parquets".