Re: Result of ORDER-BY

Поиск
Список
Период
Сортировка
От Andrew Sullivan
Тема Re: Result of ORDER-BY
Дата
Msg-id 20111118063700.GA43856@shinkuro.com
обсуждение исходный текст
Ответ на Result of ORDER-BY  ("Good Day Books" <goodday@gol.com>)
Список pgsql-general
On Fri, Nov 18, 2011 at 12:14:35PM +0900, Good Day Books wrote:
> [PostgreSQL 8.3.9]
>
> I have a query, as follows
>
> SELECT DISTINCT ON(category) category
> FROM gdb_books
> WHERE category LIKE 'Fiction%'
> GROUP BY category
>
> Does anyone have an explanation why this is not so; are the special characters (parenthesis, hyphen) just ignored?
Ifso, is there a way to force ORDER BY to include the special characters in the sort? 
>

See the other remark in this thread about GROUP BY and ORDER BY.  Note
that GROUP BY used to cause ORDER BY every time, because it was always
implemented with a sort.  That hasn't been true for several releases,
and if you're relying on that side effect it could be the cause of
this, although it's pretty surprising that you still got A, B, C in
that case.  In any case, you definitely need an ORDER BY category
here, too.  Does that make a difference?

You might also want to look at your collation.  Sort orders are
notorious for being surprising across collations.  What's this one?

A

--
Andrew Sullivan
ajs@crankycanuck.ca

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

Предыдущее
От: Christophe Pettus
Дата:
Сообщение: Re: Result of ORDER-BY
Следующее
От: Scott Marlowe
Дата:
Сообщение: Re: Incremental backup with RSYNC or something?