Multiple unnamed device in same site isn't supported (dcim_device_unique_name_site) #7394

Closed
opened 2025-12-29 20:22:53 +01:00 by adam · 5 comments
Owner

Originally created by @ChrisdAutume on GitHub (Dec 20, 2022).

NetBox version

3.4.1

Python version

3.9

Steps to Reproduce

  • Create several unnamed devices in the same site

Expected Behavior

  • Device are created and excluded from dcim_device_unique_name_site constraint

Observed Behavior

Cannot create several unnamed devices in same site.

Originally created by @ChrisdAutume on GitHub (Dec 20, 2022). ### NetBox version 3.4.1 ### Python version 3.9 ### Steps to Reproduce - Create several unnamed devices in the same site ### Expected Behavior - Device are created and excluded from dcim_device_unique_name_site constraint ### Observed Behavior Cannot create several unnamed devices in same site.
adam added the type: bug label 2025-12-29 20:22:53 +01:00
adam closed this issue 2025-12-29 20:22:53 +01:00
Author
Owner

@PaulR282 commented on GitHub (Dec 21, 2022):

I couldn't reproduce it. Just creating 2 unnamed devices that are identical in the same rack or as non-racked worked for me.

@PaulR282 commented on GitHub (Dec 21, 2022): I couldn't reproduce it. Just creating 2 unnamed devices that are identical in the same rack or as non-racked worked for me.
Author
Owner

@julianstolp commented on GitHub (Dec 21, 2022):

I also couldn't reproduce it in our testing.

@julianstolp commented on GitHub (Dec 21, 2022): I also couldn't reproduce it in our testing.
Author
Owner

@ChrisdAutume commented on GitHub (Dec 21, 2022):

Well, to be more precise. It's happening during migration process when django is applying the new constraint. I checked through psql.

django.db.utils.IntegrityError: could not create unique index "dcim_device_unique_name_site"
DETAIL:  Key (lower(name::text), site_id)=(, 547) is duplicated
netbox=# select lower(name::text), count(*) from dcim_device group by lower(name::text) having count(*) > 1;
 lower | count 
-------+-------
       |  1100
       |   201
(2 rows)

@ChrisdAutume commented on GitHub (Dec 21, 2022): Well, to be more precise. It's happening during migration process when django is applying the new constraint. I checked through psql. ``` django.db.utils.IntegrityError: could not create unique index "dcim_device_unique_name_site" DETAIL: Key (lower(name::text), site_id)=(, 547) is duplicated ``` ``` netbox=# select lower(name::text), count(*) from dcim_device group by lower(name::text) having count(*) > 1; lower | count -------+------- | 1100 | 201 (2 rows) ```
Author
Owner

@julianstolp commented on GitHub (Dec 21, 2022):

Looks like the same issue #11266 and is very likely relating to the breaking change in 3.4.0 see (https://github.com/netbox-community/netbox/releases/tag/v3.4.0)

  • Device and virtual machine names are no longer case-sensitive. Attempting to create e.g. "device1" and "DEVICE1" within the same site will raise a validation error.
@julianstolp commented on GitHub (Dec 21, 2022): Looks like the same issue #11266 and is very likely relating to the breaking change in 3.4.0 see (https://github.com/netbox-community/netbox/releases/tag/v3.4.0) > - Device and virtual machine names are no longer case-sensitive. Attempting to create e.g. "device1" and "DEVICE1" within the same site will raise a validation error.
Author
Owner

@ChrisdAutume commented on GitHub (Dec 22, 2022):

I founded out that somes devices names was empty but not null in the DB.

update dcim_device set name=NULL where name='';

Correct the problems.

@ChrisdAutume commented on GitHub (Dec 22, 2022): I founded out that somes devices names was empty but not null in the DB. `update dcim_device set name=NULL where name='';` Correct the problems.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7394