Duplicate rows with primary key constraint in PostgreSQL 10.6 I have a table that's had CONSTRAINT table_pkey PRIMARY KEY (id) since setup.

However, I recently found that I have around 100 duplicate rows (I ran select count(*) from (select count(*) from table group by id having count(*) &gt; 1) as t1 as per this old stack post. However, I'm running Postgres 10.6, which should be far after that bug.
Any ideas?
I have some suggestions based on problems I had before, not with PostgreSQL 10, but with 9.1:


Try to reindex
Try vacuum full analyze verbose


If first two option don't work, try a dump and restore. 

This happens because of a bug in indexes.