I´ve the following table with two columns. The two columns are the combined index key of the table:
ID1 ID2
A X
A Y
A Z
B Z
Now I need to do the following:
UPDATE table SET ID2=X WHERE ID2=Z
As the table has a combined key (ID1 + ID2) this leads to a "duplicate key value violates unique constraint" exception cause there is already an "A-X" combination and the update for row "A-Z" violates that key.
So my question is: Is there in Postgres an option to skip on duplicate key? Or do you have any other hint for me?
Final state of the table should be:
ID1 ID2
A X
A Y
B X