Re: Bug, feature, quirk? HELP

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Bug, feature, quirk? HELP
Дата
Msg-id 28553.987342509@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Bug, feature, quirk? HELP  ("Stoppel, Brett W" <bstoppel@ku.edu>)
Список pgsql-general
"Stoppel, Brett W" <bstoppel@ku.edu> writes:
> I tried the following command
> db=> SELECT DISTINCT name, city FROM table ORDER BY trim(table.name);
> ERROR:  For SELECT DISTINCT, ORDER BY expressions must appear in target list

> Are there work arounds?

What's wrong with doing what the message suggests?
SELECT DISTINCT trim(name), city FROM table ORDER BY trim(name);

> Should I just give up for now (i.e. wait for 7.1+n to come out)?

Don't hold your breath.  The reason for the restriction is that the
results are ambiguous without it --- maybe not terribly ambiguous in
this particular case, but it's easy to create examples where you have
no idea what values are to be used for the sort.  For example
    SELECT DISTINCT foo, bar FROM table ORDER BY baz;

            regards, tom lane

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

Предыдущее
От: "Len Morgan"
Дата:
Сообщение: Re: Bug, feature, quirk? HELP
Следующее
От: "Stan Brown"
Дата:
Сообщение: Recipe management application?