From: Igal @ Lucee.org <igal@lucee.org>
To: Psql_General (E-mail) <pgsql-general@postgresql.org>
Cc: Laurenz Albe <laurenz.albe@cybertec.at>
Cc: Pavel Křehula <pavel.krehula@nlm.cz>
Subject: Re: Case Insensitive Comparison with Postgres 12
Date: Thu, 10 Oct 2019 05:41:47 -0700
Message-ID: <9803fc4d-7fe4-33f3-014e-defdfcc59873@lucee.org> (raw)
In-Reply-To: <9ad4f42faa10f1aa4e81e3ed8160d36d0d39856a.camel@cybertec.at>
References: <CA+zig0-9TpMC6cmi9Vz5sGM5abhh0XF7H+xokjcRUSSmtV4aYQ@mail.gmail.com>
<9ad4f42faa10f1aa4e81e3ed8160d36d0d39856a.camel@cybertec.at>
On 10/9/2019 12:34 AM, Laurenz Albe wrote:
> 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/
Thank you all for replying. I tried to use the locale suggested by both
Laurenz and Pavel, en-US-u-ks-level2, but I'm still getting false for a
simple comparison of 'Abc' = 'abc'. I tried the locale both as a
'string' and as an "identifier":
> select version();
version |
-------------------------------------------------------------------------------------------------------|
PostgreSQL 12.0 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5
20150623 (Red Hat 4.8.5-39), 64-bit|
> drop collation if exists case_insensitive;
> create collation case_insensitive (
provider=icu, locale="en-US-u-ks-level2", deterministic=false
);
> select 'Abc' = 'abc' collate case_insensitive as is_equal;
is_equal|
--------|
false |
What am I doing wrong here?
Thanks,
Igal
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: igal@lucee.org, laurenz.albe@cybertec.at, pavel.krehula@nlm.cz
Subject: Re: Case Insensitive Comparison with Postgres 12
In-Reply-To: <9803fc4d-7fe4-33f3-014e-defdfcc59873@lucee.org>
References: <CA+zig0-9TpMC6cmi9Vz5sGM5abhh0XF7H+xokjcRUSSmtV4aYQ@mail.gmail.com> <9ad4f42faa10f1aa4e81e3ed8160d36d0d39856a.camel@cybertec.at> <9803fc4d-7fe4-33f3-014e-defdfcc59873@lucee.org>
* 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