Bug report #7944
addFeatures in provider does not return properly the feature ID
|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 #:||16811|
In python, when doing:
ans, fout = provider.addFeatures( [fin] )
fin is properly added, but doing
fout.id() returns 0.
In postgres, the feature is created and has a different ID.
It is a regression because it used to work.
The same problem existed before but was solved in 7028827
#1 Updated by Matthias Kuhn over 6 years ago
I had a look at this today. It's quite strange, because the result is assigned in the provider and the proper id is still available from sip.
It looks as if a copy of the featurelist is passed to the dataprovider, where the proper id is assigned, but then the copy is deleted without the results being mapped back to the python object.
I also couldn't find any commits which would have changed related code.
Can you tell me the last working version?