Re: Very puzzling sort behavior

From: Peter Geoghegan <peter(dot)geoghegan86(at)gmail(dot)com>
To: Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com>
Cc: PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Very puzzling sort behavior
Date: 2015-09-10 19:44:00
Message-ID: CAEYLb_VFc6w5EbsFL-GRd-0On3s8-wEKX4An3ykLuVoc2w6M8Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 10, 2015 at 12:35 PM, Ken Tanzer <ken(dot)tanzer(at)gmail(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2015-09-10 19:44:55 Re: Very puzzling sort behavior
Previous Message Ken Tanzer 2015-09-10 19:35:01 Very puzzling sort behavior