Solve problem with uniq in PG, but not order