Re: Case Insensitive Comparison with Postgres 12

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Case Insensitive Comparison with Postgres 12
Date: 2019-10-10 13:22:41
Message-ID: 7f3e8791-fa18-b355-d377-465cba605616@gmx.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Igal @ Lucee.org schrieb am 10.10.2019 um 14:41:
> 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":
>
>> 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?

Check the version of libicu that your Linux is using.
That locale format requires version 54 or later.
(My up-to-date CentOS 7.7 for example is still using version 50 and the EDB Windows binaries include version 53).

In another thread about ICU problems, Daniel Verite explained that in more detail:

> With ICU 53 or older, instead of the locale above, we must use the old-style syntax:
>
> locale = 'de-DE(at)colStrength=secondary'

In your case I guess, it should be

locale = 'en-US(at)colStrength=secondary'

Thomas

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2019-10-10 13:35:06 Re: websearch_to_tsquery() and apostrophe inside double quotes
Previous Message Jehan-Guillaume de Rorthais 2019-10-10 13:15:46 Re: logical replication - negative bitmapset member not allowed