Re: ORDER BY and DISTINCT ON

Поиск
Список
Период
Сортировка
От Neil Conway
Тема Re: ORDER BY and DISTINCT ON
Дата
Msg-id 87fzfmg5p4.fsf@mailbox.samurai.com
обсуждение исходный текст
Ответ на Re: ORDER BY and DISTINCT ON  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: ORDER BY and DISTINCT ON  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane <tgl@sss.pgh.pa.us> writes:
> This was discussed before --- see the archives.  I believe the
> conclusion was that the results would actually be nondeterministic
> if we used two sort steps (that's what the code comment means by
> "rather unpredictable").

Does the non-determinism you're referring to result from an ORDER BY
on a non-deterministic expression, or the non-determinism that results
from picking an effectively random row because the ORDER BY isn't
sufficient?

I searched the archives and found Stephen Szabo's comment[1] that:
 The query you've written is potential non-deterministic if you have a people_id that has multiple rows with different
lastnames that meet the where clause.
 

Which seems like an unconvincing justification for rejecting the
query: we accept DISTINCT ON with no ORDER BY clause at all, for
example.

-Neil

[1] http://archives.postgresql.org/pgsql-hackers/2001-07/msg00588.php



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

Предыдущее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Resurrecting pg_upgrade
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Resurrecting pg_upgrade