Duplicate rows - how to remove one?
This will work I think:
with d as 
  ( select ctid, row_number() over (partition by t.*) as rn 
    from tablename as t 
  ) 
delete from tablename as t 
using d 
where d.rn &gt; 1 
  and d.ctid = t.ctid ;

And another variation. Not sure which will be more efficient:
delete from tablename as t 
where exists 
      ( select * 
        from tablename as d 
        where d.ctid &gt; t.ctid 
          and d.* is not distinct from t.*
      ) ;

But note what the docs say abut ctid:

ctid
The physical location of the row version within its table. Note that although the ctid can be used to locate the row version very quickly, a row's ctid will change if it is updated or moved by VACUUM FULL. Therefore ctid is useless as a long-term row identifier. The OID, or even better a user-defined serial number, should be used to identify logical rows.

So, if the table was created WITH OIDS, use that instead.