Bug report #5758
Primary key issue when using merge attributes of selected features tool
|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|
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.
#4 Updated by Alexandre Neto over 6 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 over 6 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).