Re: distinct on doesn't fail without order by? why?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: depesz(at)depesz(dot)com
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: distinct on doesn't fail without order by? why?
Date: 2009-05-18 22:57:40
Message-ID: 2750.1242687460@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2009-05-19 08:32:59 Re: BUG #4812: statistics not available on tables containing only hstore column
Previous Message Jeff Davis 2009-05-18 21:56:33 Re: distinct on doesn't fail without order by? why?