Re: Warts with SELECT DISTINCT

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Warts with SELECT DISTINCT
Дата
Msg-id 20060504062153.GB26841@wolff.to
обсуждение исходный текст
Ответ на Re: Warts with SELECT DISTINCT  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Warts with SELECT DISTINCT
Список pgsql-hackers
On Thu, May 04, 2006 at 01:13:20 -0400, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> 
> I think it's a fair point that we could allow "SELECT DISTINCT x ORDER BY
> foo(x)" if foo() is stable, but that does not imply that sorting by x is
> interchangeable with sorting by foo(x).  foo = abs is a trivial
> counterexample.

I misunderstood Greg's example. Sorting by (foo(x), x) is a suitable
replacement for sorting by foo(x). So that it would be OK to rewrite
SELECT DISTINCT x ORDER BY foo(x)
as
SELECT DISTINCT ON (foo(x), x) x ORDER BY foo(x)

Whether or not this is worthwhile to automate, I am not in a good position
to judge.


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Warts with SELECT DISTINCT
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Warts with SELECT DISTINCT