Re: Warts with SELECT DISTINCT

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Warts with SELECT DISTINCT
Дата
Msg-id 18946.1146719600@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: Warts with SELECT DISTINCT  (Bruno Wolff III <bruno@wolff.to>)
Ответы Re: Warts with SELECT DISTINCT
Список pgsql-hackers
Bruno Wolff III <bruno@wolff.to> writes:
> Greg Stark <gsstark@mit.edu> wrote [ baldly summarized ]
>> [ x > y implies upper(x) > upper(y) ]

> I don't think you can assume that that will be true for any locale.

Whether or not that may actually be true for upper() (I share Bruno's
skepticism, but maybe it's so), it really does not matter because the
planner doesn't have enough knowledge about the behavior of upper() to
make such an inference.

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.

As far as the original point goes: feel free to reimplement DISTINCT,
but don't break the documented behavior of DISTINCT ON + ORDER BY, or
you'll have a lot of unhappy villagers appear on your doorstep bearing
torches and pitchforks.  It might be mostly an implementation artifact,
but it's an awfully useful one ...
        regards, tom lane


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

Предыдущее
От: Bruno Wolff III
Дата:
Сообщение: Re: Warts with SELECT DISTINCT
Следующее
От: Christopher Kings-Lynne
Дата:
Сообщение: Re: Rethinking locking for database create/drop vs connection