If you encounter this issue in your environment, do the following:
The following is an example of the output where the device called JTI-L1-4507R-1 is still present in the database:
select count(*),device_status from cm_device group by device_status;
voyencedb=# select count(*),device_status from cm_device group by device_status;
count | device_status
-------+--------------------------------
1 | enum.deviceStatus.unclassified
154 | enum.deviceStatus.operational
3 | enum.deviceStatus.unconfigured
select device_name,device_idx from cm_device where device_name like '%<deviceName>%';voyencedb=# select device_name,device_idx from cm_device where device_name like '%JTI-L1-4507R-1%';device_name | device_idx----------------+------------
JTI-L1-4507R-1 | 1104
(1 row)