[Qgis-developer] PostGIS warning details in QGIS master

Pedro Venâncio pedrongvenancio at gmail.com
Thu Oct 2 16:48:53 PDT 2014


Hi Denis,

I just tested on Linux, with two simple shapefiles (attached), with only
two lines each. Making a copy of the shapefiles, all goes well.

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.

I also tested this with points, multipoints, and Multipolygons, and the
same happens.

The proof that I believe show that the problem is in primary key is:

importing the two layers attached to the postgis with dbmanager, you get

layer_1
id_0* | id | desc
1 | 1 | 1
2 | 2 | 2

layer_2
id_0* | id | desc
1 | 1 | 1
2 | 2 | 2

*pkey

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:

layer_2
id_0* | id | desc
1 | 1 | 1
3 | 2 | 2

(id_0 is 3 because of the sequence).

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.

What do you think?

Thanks!

Best regards,
Pedro




2014-10-02 14:42 GMT+01:00 Rouzaud Denis <denis.rouzaud at gmail.com>:

> Hi Pedro,
>
> As said, copy/paste only tries to convert geometries and will paste if
> possible.
>
> Foreign key violation is only detected by Postgis, so the reason why QGIS
> is not actually pasting is not due to a FKey violation.
>
> Do you have a debugging environment or can you provide some demo data?
>
> Best wishes,
>
> Denis
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141003/52feca7b/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: qgis_25_copy_paste.zip
Type: application/zip
Size: 3756 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20141003/52feca7b/attachment.zip>


More information about the Qgis-developer mailing list