Skip to content

Error while creating device: duplicate key value violates unique constraint "dcim_device_pkey" #7405

Answered by kkthxbye-code
gmiranda asked this question in Q&A
Discussion options

You must be logged in to vote

A vid on a VLAN is not the same as the autoincrementing id that's present on all models.

You should be able to fix it by either deleting the devices you created or accessing postgres database and altering the sequence. Something like this:

ALTER SEQUENCE dcim_device_id_seq RESTART WITH 999;

Replace 999 with the id of the highest numbered device you currently have.

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by gmiranda
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #7402 on September 30, 2021 12:24.