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 по дате отправления: