Bug report #18130

Using uuid generator function in field calculator return the same value for each feature

Added by Dominique Lyszczarz over 3 years ago. Updated over 3 years ago.

Category:Field calculator
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:26023


It seems to me that the correct behaviour here is to compute a distinct uuid for each feature.

A work around is to define a custom function like this

@from qgis.core import *
from qgis.gui import *
import uuid

@qgsfunction(args='auto', group='Custom')
def getUUID(feature, parent):

return '{' + str(uuid.uuid4()) + '}'@

Associated revisions

Revision 605ea376
Added by Nyall Dawson over 3 years ago

Fix uuid() function returns the same uuid

Fixes #18130


#1 Updated by Nyall Dawson over 3 years ago

  • % Done changed from 0 to 100
  • Status changed from Open to Closed

#2 Updated by Giovanni Manghi over 3 years ago

  • Resolution set to fixed/implemented

Also available in: Atom PDF