We are running into an issue on the latest release of OpenPDC when we try to add a new concentrator input device via the input device wizard. When we get to the last step of Selecting Devices to Configure, when we click finish, we get the following error:
Violation of UNIQUE KEY constraint ‘UK_UniqueID’. Cannot insert duplicate key in object ‘dbo.Device’. The duplicate key value is (00000000-0000-0000-0000-000000000001).
The statement has been terminated.
It seems like it is trying to add the devices with the same unique ID for every device. My workaround was to delete the UniqueId constraint, let the wizard add the devices with the same UniqueID, and create new UUIDs for the records. After that, I added the constraint back in.
Is this a known issue? Has anyone else run into this?
FYI, I’m assuming this is SQL Server based on the dbo.Device identifier in the error message.
Check the default constraint on the Device.UniqueID column. It should be using the newid() function, but it sounds like it may have been changed somehow.
You may also want to try simply running SELECT newid() to see what that function returns on your server. If it’s actually returning the same value every time, then I’m not sure what to tell you. You’d probably be better off contacting Microsoft at that point.
Run the PMU Connection Tester and save the Connection File.
Then, in openPDC Manager, Inputs → Input Device Wizard.
Next, Next, etc. choose to let the wizard Configuration from the device, which is itself a concentrator.
Enter the Acronym and description.
On the last page, it shows 5 devices to import from the concentrator. I don’t make any modifications to the names or phasors, etc.
Click Finish and that’s when the error is thrown about the Unique constraint violation.
Check the database and see the GUID value of 00000000-0000-0000-0000-000000000001 in dbo.Device.
I know that SELECT newid() is working correctly when I execute it independently, so I don’t think that’s the issue. I haven’t looked through the source code yet, but I’m wondering if the value is getting created and set there.