Bug #6164

postgis layer: duplicate primary key

Added by michele zanolli 10 months ago. Updated 5 months ago.

Status:Closed Start Date:08/07/2012
Priority:Blocker Due date:
Assigned to:- % Done:

0%

Category:Digitising
Target version:Version 2.0.0
Platform: Patch supplied:No
Platform version: Affected version:master
Status info: Causes crash or corruption:No
Resolution:

Description

When I try to copy one feature from a postgis layer to another (or to the same layer), the value of the primary key (integer serial) is copied as it is, generating a duplicate key error:

Errors: ERROR: 1 feature(s) not added.

  Provider errors:
  PostGIS error while adding features: ERROR:  duplicate key value violates unique constraint "grafo_pk" 
DETAIL:  Key (ogc_fid)=(2630) already exists.

The same thing if I hide the pk field in the "Fields" property of the layer, to tell QGIS not to use it for copying.

Affected version: master and 1.8

Whith 1.7.4 it was working correctly!


Related issues

related to Quantum GIS Desktop - Bug #6422: QGIS delete Postgis features after trying to merge them Closed 09/27/2012

Associated revisions

Revision 2a002c558e923d51142ca1e4c280b2e58826b291
Added by Jürgen Fischer 5 months ago

[API] make primary key field indexes available:
- add QgsVectorLayer::pendingPkAttributeList()
- add QgsVectorDataProvider::pkAttributeIndexes()
- skip primary key attribute when pasting features (fixes #6164)
- default to skip primary key attribute in when merging features/attributes
- reset primary key attributes to default value when splitting features (better fix for #6060)
- comment out unused QgsPasteTransformations

History

Updated by Giovanni Manghi 10 months ago

  • Status changed from New to Feedback

Did you tested qgis-master? please give it a try and report back, thanks.

Updated by michele zanolli 10 months ago

Giovanni Manghi wrote:

Did you tested qgis-master? please give it a try and report back, thanks.

michele zanolli wrote:

Affected version: master and 1.8

With 1.7.4 it was working correctly!

Updated by Giovanni Manghi 10 months ago

  • Priority changed from Normal to Blocker

michele zanolli wrote:

Affected version: master and 1.8

With 1.7.4 it was working correctly!

sorry, I overlooked your answer.

Anyway it should be a regression so I'll tag this as blocker.

Updated by Jürgen Fischer 5 months ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF