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

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [HACKERS] SELECT DISTINCT i FROM dtest ORDER BY j
Дата
Msg-id 199812201903.OAA01434@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] SELECT DISTINCT i FROM dtest ORDER BY j  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] SELECT DISTINCT i FROM dtest ORDER BY j
Следующее
От: Oleg Broytmann
Дата:
Сообщение: PostgreSQL 6.4 like bug(?)