hubert depesz lubaczewski <depesz(at)depesz(dot)com> writes:
> I was under impression that select distinct on (xx) ...
> will fail if xx doesn't match the left most part of order by. i.e. it
> requires order by xx, while allowing order by xx, something, else.
No, it requires that *if* you specify an ORDER BY, it agrees with
the DISTINCT ON.
regards, tom lane