> > >> * 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...
In response to
pgsql-hackers by date
|Next:||From: Clark Evans||Date: 1998-12-20 04:49:10|
|Subject: SELECT DISTINCT i FROM dtest ORDER BY j|
|Previous:||From: Bruce Momjian||Date: 1998-12-19 23:37:59|
|Subject: Re: [HACKERS] Upgrades for 6.4.1|