From: | Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Hannu Krosing <hannu(at)trust(dot)ee>, hackers(at)postgreSQL(dot)org, pgsql-sql(at)postgreSQL(dot)org |
Subject: | Re: [SQL] Re: [HACKERS] SELECT DISTINCT question |
Date: | 1999-09-23 17:18:18 |
Message-ID: | 199909231718.NAA19629@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-sql |
Tom, any status on this DISTINCT ON ripout?
> Hannu Krosing <hannu(at)trust(dot)ee> writes:
> >> "DISTINCT will eliminate all duplicate rows from the selection.
> >> DISTINCT ON column will eliminate all duplicates in the specified column;
> >> this is equivalent to using GROUP BY column."
>
> > If it is equivalent to GROUP BY then it should allow only aggregates
> > in non-distinct columns, like:
> > select distinct on date date, sum(bytes) from access_log;
> > If it does not, then it should be files as a bug imho.
>
> It does not. Whether that is a bug is hard to say, since there is no
> standard I know of that says what it *is* supposed to do.
>
> If you look at the select_distinct_on regress test outputs, I bet you
> will be even less happy:
>
> QUERY: SELECT DISTINCT ON string4 two, string4, ten
> FROM tmp
> ORDER BY two using <, string4 using <, ten using <;
> two|string4|ten
> ---+-------+---
> 0|AAAAxx | 0
> 0|HHHHxx | 0
> 0|OOOOxx | 0
> 0|VVVVxx | 0
> 1|AAAAxx | 1
> 1|HHHHxx | 1
> 1|OOOOxx | 1
> 1|VVVVxx | 1
> (8 rows)
>
> That's not exactly my idea of "distinct" values of string4 ---
> but apparently whoever made up the regress test thought it was OK!
>
> Can anyone defend this feature or provide a coherent definition
> of what it's supposed to be doing? My urge to rip it out is
> growing stronger and stronger...
>
> regards, tom lane
>
>
--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 1999-09-23 17:27:11 | Re: [HACKERS] create rule changes table to view ? |
Previous Message | Andreas Zeugswetter | 1999-09-23 16:47:55 | Re: [HACKERS] [GENERAL] when are indexes used? |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 1999-09-23 21:27:37 | Re: [SQL] Re: [HACKERS] SELECT DISTINCT question |
Previous Message | Daniel Péder | 1999-09-23 17:10:57 | RE: [SQL] partial indexes (indices) |