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

Re: [HACKERS] SELECT DISTINCT i FROM dtest ORDER BY j

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: clark(dot)evans(at)manhattanproject(dot)com, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] SELECT DISTINCT i FROM dtest ORDER BY j
Date: 1998-12-20 19:03:45
Message-ID: 199812201903.OAA01434@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
> The trouble is that if you have several tuples with the same i and
> different j, doing the DISTINCT first implies throwing away all but
> one of those tuples.  Which one do you keep?  It matters because
> some of those tuples might sort differently than others.
> 
> As far as I can see, this combination of features is not well-defined on
> its surface.  You have to make some additional assumptions (about which
> of the possible j values is kept for sorting) in order to define a
> unique result.

That is an interesting argument.  It suggests it should not be a TODO
item.  I can see cases where you would want to do the DISTINCT before
the ORDER BY, so the current behavior seems correct.

Removing it from TODO list.

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

In response to

pgsql-hackers by date

Next:From: Oleg BroytmannDate: 1998-12-21 10:24:42
Subject: PostgreSQL 6.4 like bug(?)
Previous:From: Tom LaneDate: 1998-12-20 17:53:30
Subject: Re: [HACKERS] SELECT DISTINCT i FROM dtest ORDER BY j

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