Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org, pgsql-sql(at)postgresql(dot)org
Subject: Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace
Date: 2000-01-26 18:34:54
Message-ID: Pine.LNX.4.21.0001260143120.9535-100000@localhost.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-sql

On 2000-01-24, Tom Lane mentioned:

> 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.

Our documents say that DISTINCT ON is equivalent to GROUP BY. I still
don't see why that wouldn't be true. You can always rewrite

select distinct on a a,b from test

as

select a, xxx(b) from test group by a

where xxx is some aggregate function (presumably min or max).

You can also rewrite

select distinct on a a,b,c from test

as

select a, b, c from test group by a, b, c

or using some aggregates here as well. At least you can control your
results that way.

--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2000-01-26 18:35:14 Re: [HACKERS] Inheritance, referential integrity and other constraints
Previous Message Peter Eisentraut 2000-01-26 18:34:38 Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace

Browse pgsql-sql by date

  From Date Subject
Next Message Tom Lane 2000-01-26 18:40:54 Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace
Previous Message Peter Eisentraut 2000-01-26 18:34:38 Re: [HACKERS] DISTINCT ON: speak now or forever hold your peace