PostGIS warning details in QGIS master

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

PostGIS warning details in QGIS master

Pedro Venâncio-2
It seems that there were changes in warning messages in QGIS master.

When trying to copy features from a PostGIS layer in QGIS master to another, in the moment of pasting to the destination layer, I get the warning message "Paste features: no features could be succesfully pasted.", however it does not show the reason.

https://dl.dropboxusercontent.com/u/5772257/qgis/warning_message_qgis_25.jpg

In previous versions (2.2 and 2.4), QGIS handled this issue differently. It allowed pasting and only when saving showed the error message with details (violation of the unique constraint on the primary key field).

https://dl.dropboxusercontent.com/u/5772257/qgis/warning_message_qgis_22.jpg
https://dl.dropboxusercontent.com/u/5772257/qgis/warning_message_qgis_24.jpg

This change was intentional or can be considered a bug?

Thanks!

Best regards,
Pedro Venâncio

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PostGIS warning details in QGIS master

3nids

Hi,

Now copy/paste tries to convert geometries to match layer destination. So, you probably had incompatible geometries like trying to paste lines in a point layer.

I can try to provide a better feedback, but as I remember it was not so easy.

Greetings

Denis

Le 1 oct. 2014 15:58, "Pedro Venâncio" <[hidden email]> a écrit :
It seems that there were changes in warning messages in QGIS master.

When trying to copy features from a PostGIS layer in QGIS master to another, in the moment of pasting to the destination layer, I get the warning message "Paste features: no features could be succesfully pasted.", however it does not show the reason.

https://dl.dropboxusercontent.com/u/5772257/qgis/warning_message_qgis_25.jpg

In previous versions (2.2 and 2.4), QGIS handled this issue differently. It allowed pasting and only when saving showed the error message with details (violation of the unique constraint on the primary key field).

https://dl.dropboxusercontent.com/u/5772257/qgis/warning_message_qgis_22.jpg
https://dl.dropboxusercontent.com/u/5772257/qgis/warning_message_qgis_24.jpg

This change was intentional or can be considered a bug?

Thanks!

Best regards,
Pedro Venâncio

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PostGIS warning details in QGIS master

Pedro Venâncio-2
Hi Denis,

Now copy/paste tries to convert geometries to match layer destination. So, you probably had incompatible geometries like trying to paste lines in a point layer.


Not in this case. Both layers were geometry (MultiLineString,20790).

In previous versions the only problem that the warning message showed was a violation of the PK constraint (as you can see in the images). And, in fact, after that I did the job in QGIS master DB Manager, with an insert into and select, skiping the PK field (serial), and it worked well.

Tested with today's QGIS master from OSGeo4W (64bits).

Thanks!

Pedro

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PostGIS warning details in QGIS master

3nids
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


On 01 Oct 2014, at 17:23, Pedro Venâncio <[hidden email]> wrote:

Hi Denis,

Now copy/paste tries to convert geometries to match layer destination. So, you probably had incompatible geometries like trying to paste lines in a point layer.



Not in this case. Both layers were geometry (MultiLineString,20790).

In previous versions the only problem that the warning message showed was a violation of the PK constraint (as you can see in the images). And, in fact, after that I did the job in QGIS master DB Manager, with an insert into and select, skiping the PK field (serial), and it worked well.

Tested with today's QGIS master from OSGeo4W (64bits).

Thanks!

Pedro


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PostGIS warning details in QGIS master

Pedro Venâncio-2
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 <[hidden email]>:
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

_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer

qgis_25_copy_paste.zip (5K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: PostGIS warning details in QGIS master

3nids
QGIS is not pasting the field of the primary key to avoid conflict.

I am not sure to understand your problem.

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.

paste was successful.

Could you provide a small dump of your postgis layers and the exact steps to reproduce?





On 03 Oct 2014, at 01:48, Pedro Venâncio <[hidden email]> wrote:

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 <[hidden email]>:
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
<qgis_25_copy_paste.zip>


_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer
Reply | Threaded
Open this post in threaded view
|

Re: PostGIS warning details in QGIS master

Pedro Venâncio-2
Hi Denis,

This is even more strange. "Paste features: no features could be successfully pasted." warning only appears when selecting more than one feature. Please see the screencast:

https://dl.dropboxusercontent.com/u/5772257/qgis/copy_paste/qgis_copy_paste.avi

Test data: https://dl.dropboxusercontent.com/u/5772257/qgis/copy_paste/tables2.sql

Thanks!

Pedro



_______________________________________________
Qgis-developer mailing list
[hidden email]
http://lists.osgeo.org/mailman/listinfo/qgis-developer