From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter.eisentraut@enterprisedb.com>
Cc: Jakub Jedelsky <jakub.jedelsky@gooddata.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: case insensitive collation of Greek's sigma
Date: Wed, 01 Dec 2021 14:49:24 -0500
Message-ID: <1989905.1638388164@sss.pgh.pa.us> (raw)
In-Reply-To: <9e3220da-d47e-add7-8b97-7c65b12ff6d7@enterprisedb.com>
References: <CAC1JxDQhi_M4WO4e19qPmcOGpN6NKJz60zsdXMuCHwVuE3_Ldw@mail.gmail.com>
<9e3220da-d47e-add7-8b97-7c65b12ff6d7@enterprisedb.com>
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> Running lower() like this is really the wrong thing to do. We should be
> doing "case folding" instead, which normalizes these differences for the
> purpose of case-insensitive comparisons.
That just begs the question: if tolower (or towlower) isn't the
appropriate API, what is? Perhaps ICU has something for a more
generalized notion of case-similarity, but I'm not aware of any such
thing in the POSIX API.
BTW, I think it's only accidental that the regex example shown upthread
gets the right answer. In that example, what's happening is that we
consider a letter in a case-insensitive regex to match itself, or
tolower() of itself, or toupper() of itself. Both σ and ς have Σ
as toupper() so they both work. But if you'd written Σ in the regex,
only one of σ and ς would match that as a data character. (Haven't
actually tested this, but given the way the code works I'm pretty
sure it's so.) Again, it's hard to see how to do better atop a POSIX
locale library.
regards, tom lane
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: tgl@sss.pgh.pa.us, peter.eisentraut@enterprisedb.com, jakub.jedelsky@gooddata.com
Subject: Re: case insensitive collation of Greek's sigma
In-Reply-To: <1989905.1638388164@sss.pgh.pa.us>
References: <CAC1JxDQhi_M4WO4e19qPmcOGpN6NKJz60zsdXMuCHwVuE3_Ldw@mail.gmail.com> <9e3220da-d47e-add7-8b97-7c65b12ff6d7@enterprisedb.com> <1989905.1638388164@sss.pgh.pa.us>
* 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