Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace - Mailing list pgsql-hackers

From Chris Bitmead
Subject Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace
Date
Msg-id 388D0D55.84F13203@bitmead.com
Whole thread Raw
In response to DISTINCT ON: speak now or forever hold your peace  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace  (Philip Warner <pjw@rhyme.com.au>)
Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Tom Lane wrote:
> 
> If I don't hear loud hollers very soon, I'm going to eliminate the
> DISTINCT ON "feature" for 7.0.  As previously discussed, this feature
> is not standard SQL and has no clear semantic interpretation.

I don't feel overly strongly about this, but if I remember right you can
do some pretty cool things with this feature, provided you do define
some semantics clearly. Like I think you can find the first tuple
(given some ORDER BY clause) that fulfills some criteria. I think it is

SELECT DISTINCT ON name name, age ORDER BY age;

will get the youngest person. This might not be clearly specified now,
but
as long as it's useful, how about clearly defining it? I don't know that
there is an easy way of doing this in standard SQL. I don't see any
problems with useful extensions to SQL. If people want standards, they
don't have to use it.


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] Re: pg_dump possible fix, need testers.
Next
From: Don Baccus
Date:
Subject: Re: [HACKERS] Happy column dropping