Duplicate rows with primary key constraint in PostgreSQL 10.6
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.