RE: [HACKERS] Upgrades for 6.4.1 - Mailing list pgsql-hackers

From Stupor Genius
Subject RE: [HACKERS] Upgrades for 6.4.1
Date
Msg-id 000801be2bca$b0bfcaa0$ce98accf@darren
Whole thread Raw
In response to Re: [HACKERS] Upgrades for 6.4.1  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-hackers
> > >> * SELECT DISTINCT i FROM dtest ORDER BY j generates strange output
> > 
> > > In my simple test case, it orders by j, then only shows i. Is that
> > > strange?
> > 
> > The thing that is "strange" is that you get nonunique values of i,
> > which is definitely a bit unexpected for "SELECT DISTINCT":
> > I don't know whether the SQL standard defines how this combination of
> > features ought to work ... but our current behavior seems fairly
> > surprising...
> 
> Re-added to TODO list.

I don't know if I would necessarily call it "strange", more like
"understandable" if you consider the fact that the ORDER BY is being
done first on the data set rather than the distinct.

It would seem to me that the distinct should apply first though.
I would expect the ORDER BY clause to order whatever tuples are
returned by the SELECT, and that would imply doing DISTINCT first.

Just my two cents...
darrenk


pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] Upgrades for 6.4.1
Next
From: Clark Evans
Date:
Subject: Re: [HACKERS] Upgrades for 6.4.1