Issues
Issues copied to clipboard
Release creation fails with `Cannot insert duplicate key` error
When creating a release, the following error occurs (in part):
Violation of PRIMARY KEY constraint 'PK_VariableSet_Id'. Cannot insert duplicate key in object 'dbo.VariableSet'.
When a release is created, the system snapshots any variables that have changed. It uses an ID convention that appends the version number and a random 5 characters to the ID.
Normally this is ok as the version number should be monotonically incrementing. However there are a number of situations where the version number is not incremented, or we pull out an older snapshot for comparison.
The 5 characters give a possible 45 million combinations, which means that once there are 45,000 snapshots, there ia a 1 in 1,000 chance of a clash.
Workaround
Create the release again