test=*# select * from dup;
a | b
---+---
1 | 1
1 | 2
2 | 1
1 | 1
3 | 3
3 | 3
(6 rows)

test=*# select * from dup where (ctid,a,b) not in (select distinct on (a,b) ctid,* from dup);
a | b
---+---
1 | 1
3 | 3
(2 rows)

another approach:

select a,b from dup group by a,b having count(*) > 1;

pgsql-general mailing list