pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: Dominique Devienne <ddevienne@gmail.com>
Cc: pgsql-general@postgresql.org
Subject: Re: Losing my latin on Ordering...
Date: Tue, 14 Feb 2023 12:40:46 +0100
Message-ID: <2d3c66e7c075ae9efe691eaa3b1040c6ce393ed7.camel@cybertec.at> (raw)
In-Reply-To: <CAFCRh-_K09U+Zr0YY-nV7ts++WZ-XAR2kG3osNC03t6_LwA-xA@mail.gmail.com>
References: <CAFCRh--xt-J8awOavhB216kom6TQnaP35TTVEQQS5bHH7gMemQ@mail.gmail.com>
	<5f395b5b2e1f135f487acb96882f89d012fead13.camel@cybertec.at>
	<CAFCRh-_K09U+Zr0YY-nV7ts++WZ-XAR2kG3osNC03t6_LwA-xA@mail.gmail.com>

On Tue, 2023-02-14 at 12:17 +0100, Dominique Devienne wrote:
> On Tue, Feb 14, 2023 at 11:23 AM Laurenz Albe <laurenz.albe@cybertec.at> wrote:
> > On Tue, 2023-02-14 at 10:31 +0100, Dominique Devienne wrote:
> > > Surely sorting should be "constant left-to-right", no? What are we missing?
> > 
> > No, it isn't.  That's not how natural language collations work.
> 
> Honestly, who expects the same prefix to sort differently based on what comes
> after, in left-to-right languages?
> How does one even find out what the (capricious?) rules for sorting in a given
> collation are?

Look at the documentation / implementation.

As far as ICU is concerned, here: https://unicode.org/reports/tr10/

> > > I'm already surprised (star) comes before (space), when the latter "comes
> > > before" the former in both ASCII and UTF-8, but that the two "Foo*" and "Foo "
> > > prefixed pairs are not clustered after sorting is just mistifying to me. So how come?
> > 
> > Because they compare identical on the first three levels.  Any difference in
> > letters, accents or case weighs stronger, even if it occurs to the right
> > of these substrings.
> 
> That's completely unintuitive...

Well, you can complain to GNU and the Unicode consortium, but that's pretty
much the way it is.

> > Yes, it soulds like the "C" collation may be best for you.  That is, if you don't
> > mind that "Z" < "a".
> 
> I would mind if I asked for case-insensitive comparisons.
> 
> So the "C" collation is fine with general UTF-8 encoding?
> I.e. it will be codepoint ordered OK?

Yes, exactly.

Yours,
Laurenz Albe





view thread (7+ messages)  latest in thread

Message-ID: <2d3c66e7c075ae9efe691eaa3b1040c6ce393ed7.camel@cybertec.at>
Permalink:  ../2d3c66e7c075ae9efe691eaa3b1040c6ce393ed7.camel@cybertec.at/
Also on:    postgresql.org/message-id/2d3c66e7c075ae9efe691eaa3b1040c6ce393ed7.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: laurenz.albe@cybertec.at, ddevienne@gmail.com
  Subject: Re: Losing my latin on Ordering...
  In-Reply-To: <2d3c66e7c075ae9efe691eaa3b1040c6ce393ed7.camel@cybertec.at>
  References: <CAFCRh--xt-J8awOavhB216kom6TQnaP35TTVEQQS5bHH7gMemQ@mail.gmail.com> <5f395b5b2e1f135f487acb96882f89d012fead13.camel@cybertec.at> <CAFCRh-_K09U+Zr0YY-nV7ts++WZ-XAR2kG3osNC03t6_LwA-xA@mail.gmail.com> <2d3c66e7c075ae9efe691eaa3b1040c6ce393ed7.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox