Bug report #5758

Primary key issue when using merge attributes of selected features tool

Added by Andreas Neumann almost 12 years ago. Updated about 10 years ago.

Status:Closed
Priority:Severe/Regression
Assignee:Jürgen Fischer
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 #:15262

Description

It seems if one uses the merge attributes of selected features tool there is no way to exclude certain columns, specifically the primary key columns. The result is that all selected features get the same primary key values, which results in a duplicate primary key issue.

It is proposed to add an additional merge way that tells QGIS to ignore this particular columnn and keep the original primary keys of the individual original features.

Other proposals are also welcome.


Related issues

Related to QGIS Application - Bug report #5475: Problem to insert splitted geometries in postgis Closed 2012-04-23
Related to QGIS Application - Bug report #6060: QGIS 1.8 Split Features doesn't work as in 1.7 Closed 2012-07-18
Related to QGIS Application - Bug report #9489: Copy/Paste issue with explicit primary keys Closed 2014-02-04
Duplicated by QGIS Application - Bug report #6045: postgis: duplicate key when merging polygons Closed 2012-07-15
Duplicated by QGIS Application - Bug report #6422: QGIS delete Postgis features after trying to merge them Closed 2012-09-27

Associated revisions

Revision 28fb6348
Added by Jürgen Fischer about 10 years ago

merge attributes: new vector api can skip attributes - use default value for skipped field (fixes #5758)

History

#1 Updated by Andreas Neumann almost 12 years ago

#5475 is a similar open bug with splitting features. Related to the primary key problem.

#2 Updated by Andreas Neumann almost 12 years ago

actually this other but is not open any more. It was decided to use the default values.

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

  • Status changed from Open to Closed

#4 Updated by Alexandre Neto about 10 years ago

  • Target version changed from Version 1.8.0 to Future Release - High Priority
  • Status changed from Closed to Reopened

I still have this problem with "merge attributes of selected features".

I'm trying to make it work in a Postgis table, with the primary key defined like this:

gid integer NOT NULL DEFAULT nextval('epvu.sgev_temp_gid_seq'::regclass)

When I use "merge attributes of selected features" with any two features, even with "skip attribute" option on gid, the value is set to NULL. I would expect it to set the default value "nextval('epvu.sgev_temp_gid_seq'::regclass)" or keep the original gid values in each selected feature.

#5 Updated by Alexandre Neto about 10 years ago

This is the error I get when trying to save my changes:

Could not commit changes to layer sgev

Errors: ERROR: 2 attribute value change(s) not applied.

  Provider errors:
      PostGIS error while changing attributes: ERROR:  null value in column "gid" violates not-null constraint
    DETAIL:  Failing row contains (null, 0106000020656B000001000000010300000002000000A9000000292FEDF01E6C..., SDR014, null, S. Domingos de Rana, Abóboda, Praça David Mourão Ferreira/ R. Antonio Machado, Urbanização da Abóboda, Nuno Louro, EMAC, 82,84, Sem rega, null, null, Manter, null, SOGRAMA_PeC, 12/1/2008, null, -9:19:45.757, 38:43:36.654, 444.210813630014, 789967, null, null, null, null, null, null, null, Passeio_caminho, SOGRAMA, S31, 2163, 0, 0, null, yes       , 2013-11-21 10:00:25.12, null).

#6 Updated by Giovanni Manghi about 10 years ago

  • Operating System deleted (all)
  • Target version changed from Future Release - High Priority to Version 2.2

I can confirm that this was working as expected in QGIS 1.8 and does not on master.

#7 Updated by Jürgen Fischer about 10 years ago

  • Status changed from Reopened to Closed

Also available in: Atom PDF