Bug report #17186

DB Manager and QGIS/Processing import in PostGIS tools are not adding "nextval()" to primary key field

Added by Giovanni Manghi almost 3 years ago. Updated over 2 years ago.

Status:Closed
Priority:Normal
Assignee:Alessandro Pasotti
Category:DB Manager
Affected QGIS version:2.18.13 Regression?:No
Operating System: Easy fix?:Yes
Pull Request or Patch supplied:No Resolution:worksforme
Crashes QGIS or corrupts data:No Copied to github as #:25085

Description

D&D in browser (from shapefile for example) and the ogr based tool in processing do the right thing.

The PostGIS data provider seems to add only the PK

https://github.com/qgis/QGIS/blob/release-2_18/src/providers/postgres/qgspostgresprovider.cpp#L3655

Without nextval(), beside not being very handy is also very easy to get bigger problems, like #17185


Related issues

Related to QGIS Application - Bug report #17185: Data loss when discarding changes in a PostGIS layer Closed 2017-09-22

History

#1 Updated by Giovanni Manghi almost 3 years ago

  • Assignee deleted (Jürgen Fischer)

#2 Updated by Luigi Pirelli almost 3 years ago

  • Easy fix? changed from No to Yes

#3 Updated by Jürgen Fischer almost 3 years ago

  • Description updated (diff)

#4 Updated by Jürgen Fischer almost 3 years ago

  • Related to Bug report #17185: Data loss when discarding changes in a PostGIS layer added

#5 Updated by Alessandro Pasotti over 2 years ago

  • Category changed from Data Provider/PostGIS to DB Manager

I verified in master and there is nothing buggy in the provider itself (when D&D from the browser the nextval() is created correctly, I suspect that the issue is in how dbmanager handles that.

#6 Updated by Alessandro Pasotti over 2 years ago

  • Status changed from Open to Feedback
  • Assignee set to Alessandro Pasotti

I cannot reproduce in master nor in 2.18.14 (tested from DB manager)

#7 Updated by Alessandro Pasotti over 2 years ago

  • Status changed from Feedback to Closed
  • Resolution set to worksforme

#8 Updated by Giovanni Manghi over 2 years ago

Alessandro Pasotti wrote:

I cannot reproduce in master nor in 2.18.14 (tested from DB manager)

yeah, it seems fixed or maybe I have just got it wrong when I reported the issue.

Also available in: Atom PDF