Re: Very puzzling sort behavior - Mailing list pgsql-general

From Peter Geoghegan
Subject Re: Very puzzling sort behavior
Date
Msg-id CAEYLb_VFc6w5EbsFL-GRd-0On3s8-wEKX4An3ykLuVoc2w6M8Q@mail.gmail.com
Whole thread Raw
In response to Very puzzling sort behavior  (Ken Tanzer <ken.tanzer@gmail.com>)
Responses Re: Very puzzling sort behavior
List pgsql-general
On Thu, Sep 10, 2015 at 12:35 PM, Ken Tanzer <ken.tanzer@gmail.com> wrote:
> Any thoughts about what's going on, what to do about it, or what obvious point I missing?  Thanks in advance!

This is the expected behavior. Locale rules will weigh the punctuation
character and space you added after primary alphabetical ordering.
Therefore, the 'E' in 'CLARKE' is more or less compared with the first
character of the first name in the case that you show, because those
code points are both what Unicode calls "primary weights".

You're not displaying the string you're ordering by anyway, so you can
just not concatenate the ', ' string (so name_last || name_first), and
it will work as you expect, I believe.

--
Regards,
Peter Geoghegan


pgsql-general by date:

Previous
From: Ken Tanzer
Date:
Subject: Very puzzling sort behavior
Next
From: Steve Crawford
Date:
Subject: Re: Very puzzling sort behavior