Delete duplicated rows by modified_date - PostgreSQL 9.2
You're mixing grouping criteria twice while creating junk_test, first in the GROUP BY subselect by having fewer conditions in the WHERE, and then in the PARTITION BY by having one extra partitioning field (time arrival).

If you can assume that older ids are older jobs, then you can identify your duplicates by joining grouped table with itself, like this:

SELECT jd.dup_group_no, j.id=jd.id AS to_keep, j.id INTO junk.test_table
FROM (
  SELECT time_job, recurrenceid, client, creatortype, deleted, MIN(id) AS id, row_number() over () AS dup_group_no
  FROM ja_jobs
  WHERE clientid = 33731 AND creatortype = 'legacyrec' AND deleted = false
  GROUP BY time_job, recurrenceid, client, creatortype, deleted
  HAVING count(*) &gt; 1
  ) jd
JOIN ja_jobs j USING (time_job, recurrenceid, clientid, creatortype, deleted);


If there is no guaranteed correlation between older ids and older jobs by creation time, the query is trickier:

SELECT jm.dup_group_no, j.id=jd.id AS to_keep, j.id INTO junk.test_table
FROM (
  SELECT DISTINCT ON (jd.time_job, jd.recurrenceid, jd.clientid, jd.creatortype, jd.deleted) jd.time_job, jd.recurrenceid, jd.clientid, jd.creatortype, jd.deleted, jd.id, row_number() over () AS dup_group_no
  FROM (
    SELECT time_job, recurrenceid, client, creatortype, deleted
    FROM ja_jobs
    WHERE clientid = 33731 AND creatortype = 'legacyrec' AND deleted = false
    GROUP BY time_job, recurrenceid, client, creatortype, deleted
    HAVING count(*) &gt; 1
    ) jd
  JOIN ja_jobs jm USING (time_job, recurrenceid, clientid, creatortype, deleted)
  ORDER BY jd.time_job, jd.recurrenceid, jd.clientid, jd.creatortype, jd.deleted, jd.created_date, jd.id
  ) jm
JOIN ja_jobs j USING (time_job, recurrenceid, clientid, creatortype, deleted);