Postgres: Getting the "partition number" instead of row_number
Use count as a window function:

SELECT id, data
FROM (SELECT id, data,
             count(*) OVER (PARTITION BY data) AS c
      FROM t) AS q
WHERE c &gt; 1;