<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">QGIS is not pasting the field of the primary key to avoid conflict.<div><br></div><div>I am not sure to understand your problem.</div><div><br></div><div>I tested with two postgis layers having a primary key. In both layers, I have a feature with pkey = 1. I copy/paste from layer 1 to layer 2, and at end I have two features in layer 2, one with pkey= 1 and the second with pkwy =2.</div><div><br></div><div>paste was successful.</div><div><br></div><div>Could you provide a small dump of your postgis layers and the exact steps to reproduce?</div><div><br></div><div><br></div><div><br></div><div><div><br></div><div><br><div><div>On 03 Oct 2014, at 01:48, Pedro Venāncio <<a href="mailto:pedrongvenancio@gmail.com">pedrongvenancio@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div>Hi Denis,<br><br></div>I just tested on Linux, with two simple shapefiles (attached), with only two lines each. Making a copy of the shapefiles, all goes well.<br><br>If you import the shapefiles to postgis (with dbmanager) to multilinestring, they stay with equal pkeys. When I do the copy / paste (which worked fine with the same data in shapefile format), QGIS shows the warning message "Paste features: no features could be successfully pasted.". Running QGIS with GNU gdb, does not appear any error at the time the warning is shown.<br><br>I also tested this with points, multipoints, and Multipolygons, and the same happens.<br><br>The proof that I believe show that the problem is in primary key is:<br><br>importing the two layers attached to the postgis with dbmanager, you get<br><br>layer_1<br>id_0* | id | desc<br>1 | 1 | 1<br>2 | 2 | 2<br><br>layer_2<br>id_0* | id | desc<br>1 | 1 | 1<br>2 | 2 | 2<br><br>*pkey<br><br>If I delete the second line of layer_2, and copy the second line of layer_1 and paste on layer_2, it already works, and layer_2 becomes:<br><br>layer_2<br>id_0* | id | desc<br>1 | 1 | 1<br>3 | 2 | 2<br><br>(id_0 is 3 because of the sequence).<br><br>The only explanation I find for this behavior is QGIS verify the violation of unique constraint of pkey field id_0, and launch the warning and prevent the pasting.<br><br>What do you think?<br><br>Thanks!<br><br>Best regards,<br>Pedro<br><br><br><br><div class="gmail_extra"><br><div class="gmail_quote">2014-10-02 14:42 GMT+01:00 Rouzaud Denis <span dir="ltr"><<a href="mailto:denis.rouzaud@gmail.com" target="_blank">denis.rouzaud@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Hi Pedro,<div><br></div><div>As said, copy/paste only tries to convert geometries and will paste if possible.</div><div><br></div><div>Foreign key violation is only detected by Postgis, so the reason why QGIS is not actually pasting is not due to a FKey violation.</div><div><br></div><div>Do you have a debugging environment or can you provide some demo data?</div><div><br></div><div>Best wishes,</div><div><br></div><div>Denis</div></div></blockquote></div></div></div>
<span><qgis_25_copy_paste.zip></span></blockquote></div><br></div></div></body></html>