Re: distinct on doesn't fail without order by? why? - Mailing list pgsql-bugs

From Tom Lane
Subject Re: distinct on doesn't fail without order by? why?
Date
Msg-id 2750.1242687460@sss.pgh.pa.us
Whole thread Raw
In response to distinct on doesn't fail without order by? why?  (hubert depesz lubaczewski <depesz@depesz.com>)
List pgsql-bugs
hubert depesz lubaczewski <depesz@depesz.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

pgsql-bugs by date:

Previous
From: Jeff Davis
Date:
Subject: Re: distinct on doesn't fail without order by? why?
Next
From: Heikki Linnakangas
Date:
Subject: Re: BUG #4812: statistics not available on tables containing only hstore column