ERROR: "duplicate key value violates unique constraint" When creating VM placement policy
search cancel

ERROR: "duplicate key value violates unique constraint" When creating VM placement policy

book

Article ID: 386244

calendar_today

Updated On:

Products

VMware Cloud Director

Issue/Introduction

Unable to create VM placement policy in VMware Cloud Director. 
 
Error:

Could not execute JDBC batch update; SQL [/* Method: unknown */ /* insert collection row com.vmware.vcloud.common.model.vdc.PvdcComputePolicyModel.providerVdcs */ insert into pvdc_compute_policy_name_pvdc (pvdc_compute_policy_name, pvdc_compute_policy_id, prov_vdc_id) values (?, ?, ?)]; constraint [uq_pv_co_po_na_p_p_c_p_n_p_v_i]; nested exception is org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update - Could not execute JDBC batch update - Batch entry 0 /* Method: unknown */ /* Method: unknown */ /* insert collection row com.vmware.vcloud.common.model.vdc.PvdcComputePolicyModel.providerVdcs */ insert into pvdc_compute_policy_name_pvdc (pvdc_compute_policy_name, pvdc_compute_policy_id, prov_vdc_id) values ('<VM Policy name>', 'f2a6####-####-####-####-######f6e0'::uuid, '<UUID>'::uuid) was aborted: ERROR: duplicate key value violates unique constraint "uq_pv_co_po_na_p_p_c_p_n_p_v_i" Detail: Key (pvdc_compute_policy_name, prov_vdc_id)=(<VM Policy name>, 33ba####-####-####-####-####c0f7) already exists. Call getNextException to see other errors in the batch. - ERROR: duplicate key value violates unique constraint "uq_pv_co_po_na_p_p_c_p_n_p_v_i" Detail: Key (pvdc_compute_policy_name, prov_vdc_id)=(<VM Policy name>, 33b####-####-####-####-######cc0f7) already exists.

Environment

VMware Cloud Director 10.5.x

Cause

This issue occurs when there is a duplicate entry for the VM placement policy in the Database. 

Resolution

To resolve this issue, contact Broadcom Support and note this Article ID (386244) in the problem description. For more information, see Creating and managing Broadcom support cases