Fix to resolve issue in Postgres where it didn't like using DISTINCT (ERROR:  for SELECT DISTINCT, ORDER BY expressions must appear in select list). Temporarily removed it (otherwise the select code would also have a .uniq added).