Re: Very puzzling sort behavior

Поиск
Список
Период
Сортировка
Искать
От
Alvaro Herrera
Тема
Re: Very puzzling sort behavior
Дата
Msg-id
20150910210237.GR2912@alvherre.pgsql
Ответ на
Список
Дерево обсуждения
Very puzzling sort behavior Ken Tanzer <ken.tanzer@gmail.com>
Re: Very puzzling sort behavior Steve Crawford <scrawford@pinpointresearch.com>
Re: Very puzzling sort behavior Peter Geoghegan <peter.geoghegan86@gmail.com>
Re: Very puzzling sort behavior Tom Lane <tgl@sss.pgh.pa.us>
Re: Very puzzling sort behavior Ken Tanzer <ken.tanzer@gmail.com>
Re: Very puzzling sort behavior Ken Tanzer <ken.tanzer@gmail.com>
Re: Very puzzling sort behavior Peter Geoghegan <peter.geoghegan86@gmail.com>
Re: Very puzzling sort behavior Ken Tanzer <ken.tanzer@gmail.com>
Re: Very puzzling sort behavior Alvaro Herrera <alvherre@2ndquadrant.com>
Re: Very puzzling sort behavior Ken Tanzer <ken.tanzer@gmail.com>
Re: Very puzzling sort behavior Andrew Sullivan <ajs@crankycanuck.ca>
Re: Very puzzling sort behavior Joe Conway <mail@joeconway.com>
Re: Very puzzling sort behavior Ken Tanzer <ken.tanzer@gmail.com>
Ken Tanzer wrote:

> Are there any other potential solutions, pitfalls or considerations that
> come to mind?  Any thoughts welcome.  And as I said, if there's not a good
> way to do this I'll probably leave it alone.

In part, it boils down to what you use the in ORDER BY clause.  If you
concatenate the last name and first name, they will be considered as a
single string and run afoul of funny behavior of dictionary sorting,
which ignores non-alphanumeric chars in the first pass.  But if you keep
them separate by using "ORDER BY last_name, first_name" then sorting
will consider the last name separately from first name, and you'd get
the results you want (I think).

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

В списке pgsql-general по дате отправления
От: Ken Tanzer
Дата:
От: Ken Tanzer
Дата:
FAQ