qgis / QGIS

QGIS is a free, open source, cross platform (lin/win/mac) geographical information system (GIS)
https://qgis.org
GNU General Public License v2.0
10.65k stars 3.01k forks source link

Add child feature in N:M relation not working correctly: child id not saved in pivot table #59546

Open ghtmtt opened 4 days ago

ghtmtt commented 4 days ago

What is the bug or the crash?

When adding a child feature the child id is not saved into the pivot table while the parent id is correctly saved. I'm attaching a small project to reproduce the issue: relation_bug.zip

It seems that the edits on the relation layer are saved when opening the form of the child feature and not when clicking on OK (you can notice it thanks to the editing icon in the legend). Therefore, when finally saving all the edits, the ones made on the relation are not stored.

Ref also to https://github.com/qgis/QGIS/pull/57689?

Screencast 2024-11-20 15:20:38.webm

Steps to reproduce the issue

The N:M relation is between the points and projects layer with the relation layer that is the pivot table.

While the new id of is correctly saved into the projects layer, it is not saved into the relation layer (the N:M):

image

Versions

QGIS LTR 3.34 but also QGIS master

QGIS version3.41.0-Master
QGIS code revisionf7b21861e26
 
Libraries
Qt version5.15.8
Python version3.11.2
GDAL/OGR version3.6.2
PROJ version9.1.1
EPSG Registry database versionv10.076 (2022-08-31)
GEOS version3.11.1-CAPI-1.17.1
SQLite version3.40.1
PostgreSQL client version15.8 (Debian 15.8-0+deb12u1)
SpatiaLite version5.0.1
QWT version6.1.4
QScintilla2 version2.13.3
OS versionDebian GNU/Linux 12 (bookworm)
 
Active Python plugins
lizmapmaster
plugin_comune_senigallia1.0.0
pluginbuilder33.2.1
QuickOSM2.2.3
faunalia_toolkit0.1.0
line_plan_survey0.1.0
osminfo1.1.0
plugin_reloader0.17
DataPlotlymaster
SpreadsheetLayers2.1.2
processing2.12.99
grassprovider2.12.99
MetaSearch0.3.6
db_manager0.1.20

Supported QGIS version

New profile

Additional context

No response