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: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PG-General Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: Re: Very puzzling sort behavior
Date: 2015-09-10 19:56:24
Message-ID: CAEYLb_W9A7RKeHBjbfF7E64C=t539jhRpdiyEUp3x-mqEvmDsQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thu, Sep 10, 2015 at 12:51 PM, Ken Tanzer <ken(dot)tanzer(at)gmail(dot)com> wrote:
> OK, can one of you help me out in understanding this? I would have thought that given "CLARK," and "CLARKE" that the comma would get compared against the E and come first. End of story, before we even get to anything farther in the string. What am I missing?

That's only how it works with the C locale. Otherwise, there are
complicated rules to weigh things like space and punctuation (and
accents/diacritics) less prominently than primary alphabetical
ordering. This is often useful. Anyway, based on what you say here, I
think you should actually "ORDER BY name_last, name_first".

--
Regards,
Peter Geoghegan

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ken Tanzer 2015-09-10 20:49:18 Re: Very puzzling sort behavior
Previous Message Ken Tanzer 2015-09-10 19:55:34 Re: Very puzzling sort behavior