PostgreSQL Duplicate key value violates unique constraint
Duplicate key value violates unique constraint
Customers table
Id | First_name | Last_name |
---|---|---|
1 | Tom | Green |
2 | Jacob | Logan |
3 | John | Pope |
insert into customers (first_name, last_name) values ('John', 'Pope');
ERROR: duplicate key value violates unique constraint
This error occurs when because on table customers
(columns: first_name, last_name) is defined
an unique index and records already exist in the table.