<div dir="ltr">Hi all,<br><br>I have noticed that references to old datasources are left in qgs xml project file when datasource of layers are changed. Tested with LTR and with the latest nightly.<br>This happens when there are relationships defined between layers.<br><br>When datasources are changed one value of the editwidget's options keeps pointing to the old location. XPath for the element containing the problematic datasource reference is:<br>/qgis/projectlayers/maplayer/fieldConfiguration/field/editWidget[@type='RelationReference']/config/Option[@type='Map']/Option[@name='ReferencedLayerDataSource']/@value<br><br>What is the meaning of this ReferencedLayerDataSource? Does it do anything?<br><br>Problem raised when I changed datasources of layers from development database to point to test database. When committing the changes to our repo I noticed that the project still had references to the development database.<br><br>For test/demo purposes I now have two geopackages test.gpkg and prod.gpkg which both contain layers 'parent' and 'child'.<br>In the QGIS project there is a relationship defined between these "parent[fid] <-> child[parent_fid]".<br><br>If the project is first built to read parent and child layers from the test.gpkg and then datasources of these layers are changed to prod.gpkg using the "Change Data Source ..." tool from the context menu of the layers then this problematic element in qgs project file is still:<br><Option name="ReferencedLayerDataSource" type="QString" value="C:/Users/lauri/projektit/tmp/qgis-relation-test/test.gpkg|layername=parent"></Option><br>This should point to the prod.gpkg. The datasource of the parent MapLayer is right "<datasource>./prod.gpkg|layername=parent</datasource>"<br><br>Another thing I noticed is that the value is an absolute path of the datasource even when QGIS should use relative paths.<br><br><br>Does QGIS use this ReferencedLayerDataSource for anything? Why is the datasource even duplicated here?<br>Should I create an issue for this? If yes should this ReferencedLayerDataSource Option just be removed or fix the value to relative and to match the datasource of the actual layer.<br><br><br>Thanks,<br><br>Lauri</div>