I have a table accounts_coin with unique constraint on (type, id), but it still have two rows with same value of (type, id), this image shows the problem: click
information might help:
- postgres server version:
postgres (PostgreSQL) 15.6 (Ubuntu 15.6-1.pgdg20.04+1) - I upgraded pg version from 9.4 to 15.6 two weeks age using pg_upgrade. I'm guessing this might be the problem, but don't know how to further look into it.
I've tried to insert another record that has the same unique value into the table, but it failed as i expected:
account=# insert into accounts_coin values ('UchihaWind', 2, 1, 0, 0, 1716860624);
ERROR: duplicate key value violates unique constraint "accounts_coin_type_id_key"
DETAIL: Key (type, id)=(2, UchihaWind) already exists.
Any help would be appreciated.
id='UchihaWind'::textin your query?amcheckto verify that the index is broken. To fix the problem, remove all duplicate values andREINDEXthe index.