Bug report #6164

postgis layer: duplicate primary key

Added by michele zanolli over 11 years ago. Updated about 11 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:-
Category:Digitising
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:15485

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 QGIS Application - Bug report #6422: QGIS delete Postgis features after trying to merge them Closed 2012-09-27

Associated revisions

Revision 2a002c55
Added by Jürgen Fischer about 11 years 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

#1 Updated by Giovanni Manghi over 11 years ago

  • Status changed from Open to Feedback

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

#2 Updated by michele zanolli over 11 years 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!

#3 Updated by Giovanni Manghi over 11 years ago

  • Priority changed from Normal to Severe/Regression

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.

#4 Updated by Jürgen Fischer about 11 years ago

  • Status changed from Feedback to Closed

Also available in: Atom PDF