Re: Case Insensitive Comparison with Postgres 12

From: Laurenz Albe <laurenz(dot)albe(at)cybertec(dot)at>
To: Igal Sapir <igal(at)lucee(dot)org>, "Psql_General (E-mail)" <pgsql-general(at)postgresql(dot)org>
Subject: Re: Case Insensitive Comparison with Postgres 12
Date: 2019-10-09 07:34:31
Message-ID: 9ad4f42faa10f1aa4e81e3ed8160d36d0d39856a.camel@cybertec.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Igal Sapir wrote:
> I am trying to test a simple case insensitive comparison. Most likely the
> collation that I chose is wrong, but I'm not sure how to choose the correct
> one (for English/US?). Here is my snippet:
>
> create collation case_insensitive(
> provider=icu, locale='en-US-x-icu', deterministic=false
> );
> select 'Abc' = 'abc' collate case_insensitive;
>
> I expected true but am getting false.
>
> Any thoughts?

Yes, the LOCALE is wrong. Use

create collation case_insensitive (
provider=icu, locale='en-US-u-ks-level2', deterministic=false
);

The name of the locale defines it.

My blog post can give a simple introduction:
https://www.cybertec-postgresql.com/en/icu-collations-against-glibc-2-28-data-corruption/

Yours,
Laurenz Albe
--
Cybertec | https://www.cybertec-postgresql.com

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Allan Jensen 2019-10-09 08:49:34 GSSAPI: logging principal
Previous Message Wim Bertels 2019-10-09 07:19:29 Re: Case Insensitive Comparison with Postgres 12