When you inserted the rows into the table, you violated the restriction, it seems that this is a unique restriction based on the error message "detected duplicate keys" error
check which columns the constraint is used on and then run a quick query like the following to see if you have any rows with duplicates (columna and columnb are columns in your unique constraint)
SELECT columna, columnb COUNT () From table HAVING COUNT ()> 1
You cannot enable a unique constraint until all rows in the table comply with the constraint rules.
susan source share