<div dir="ltr"><div><div><div><div>Hi,<br><br></div>I do the merge interactively by selecting the 2 parcels and clicking on the button "merge selected features" from the advanced digitizing toolbar. On the "merge features attributes" window, I select the attributes of the parcel A as attributes of the new/merged parcel. Like that the new/merged parcel as the same primary key than the past parcel A.<br><br></div><div>Regarding the possibility to create triggers to clean the merge, I have to think about it but seems a little bit complex given the number of tables linked to parcel table (not only operation one) and also the fact that during an editing session we can make multiple merge on the same time.<br></div><br>Regarding the type of foreign key, I have well "ON DELETE NO ACTION". Defining the foreign key to "ON DELETE CASCADE" or "ON DELETE SET NULL" is unfortunately not possible.<br><br></div>Best regards,<br></div>Thibaut.<br><div><div><div><br><br></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2015-03-03 12:10 GMT+01:00 Bernhard Ströbl <span dir="ltr"><<a href="mailto:bernhard.stroebl@jena.de" target="_blank">bernhard.stroebl@jena.de</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
the question is how you define your foreign key [1], namely what you put for "ON DELETE" (you have either NO ACTION or RESTRICT, which throw the error you receive) If you set ON DELETE CASCADE the operation would be deleted, too, probably not what you want. Maybe you should set ON DELETE SET NULL (make sure that the field can be NULL!). Afterwards you reconnect the operation and the new parcel.<br>
<br>
Bernhard<br>
<br>
<br>
[1] <a href="http://www.postgresql.org/docs/current/static/ddl-constraints.html#DDL-CONSTRAINTS-FK" target="_blank">http://www.postgresql.org/<u></u>docs/current/static/ddl-<u></u>constraints.html#DDL-<u></u>CONSTRAINTS-FK</a><br>
<br>
Am 03.03.2015 11:14, schrieb Thibaut Gheysen:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi,<br>
<br>
I would like to have your opinion in order to simplify as much as<br>
possible our current workflow.<br>
<br>
We have a table parcel and a table operation. The table operation<br>
include a foreign key to the table parcel. We have 2 parcels (A and B)<br>
but only parcel A has operations link on it. I would like to merge the 2<br>
parcels by keeping the attributes of the parcel A. The merge is doing<br>
properly but impossible to save the edit (Provider errors: PostGIS error<br>
while deleting feature: ERROR: update or delete table "parcel" violates<br>
foreign key constraint"fk_parcel" on table "operation"). I guess this is<br>
due to the fact the Qgis first delete the 2 parcels (A and B) before<br>
creating a new one (merged one).<br>
This behaviour oblige us to export the table parcel into a shapefile and<br>
make the modifications on it. Once done, we import the shapefile into<br>
PostGIS and update the parcel geometry base on it.<br>
<br>
Is there any chance to find an easier workflow, without developing a<br>
plug-in ?<br>
<br>
Thank for your help.<br>
<br>
Best regards,<br>
Thibaut.<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br></div></div><span class="">
______________________________<u></u>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-<u></u>developer</a><br>
<br>
<br></span>
__________ Information from ESET Mail Security, version of virus signature database 11260 (20150303) __________<br>
<br>
The message was checked by ESET Mail Security.<br>
<a href="http://www.eset.com" target="_blank">http://www.eset.com</a><br>
<br>
</blockquote>
<br>
<br>
<br>
__________ Information from ESET Mail Security, version of virus signature database 11260 (20150303) __________<br>
<br>
The message was checked by ESET Mail Security.<br>
<a href="http://www.eset.com" target="_blank">http://www.eset.com</a><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
______________________________<u></u>_________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org" target="_blank">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/<u></u>mailman/listinfo/qgis-<u></u>developer</a><br>
</div></div></blockquote></div><br></div>