Skip site navigation (1) Skip section navigation (2)

RE: [HACKERS] Upgrades for 6.4.1

From: "Stupor Genius" <stuporg(at)erols(dot)com>
To: "Pgsql-Hackers" <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: [HACKERS] Upgrades for 6.4.1
Date: 1998-12-20 03:41:56
Message-ID: 000801be2bca$b0bfcaa0$ce98accf@darren (view raw or flat)
Thread:
Lists: 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

In response to

Responses

pgsql-hackers by date

Next:From: Clark EvansDate: 1998-12-20 04:49:10
Subject: SELECT DISTINCT i FROM dtest ORDER BY j
Previous:From: Bruce MomjianDate: 1998-12-19 23:37:59
Subject: Re: [HACKERS] Upgrades for 6.4.1

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group