Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIXlX-00035T-Fk for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 12:41:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIXlV-0007x3-RK for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 12:41:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIXlV-0007wm-Fp for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2019 12:41:57 +0000 Received: from mail-qk1-x741.google.com ([2607:f8b0:4864:20::741]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIXlS-0008Jy-59 for pgsql-general@postgresql.org; Thu, 10 Oct 2019 12:41:56 +0000 Received: by mail-qk1-x741.google.com with SMTP id w2so5446684qkf.2 for ; Thu, 10 Oct 2019 05:41:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lucee.org; s=google; h=subject:to:references:from:cc:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=rRo7iKWn0W4dxYINKDgU6NK/eCy+Sd+S26eku4plTYk=; b=SLmOxXnSw2ck0bx+rSuyRoElrHGsNExBWtjjVH334yClPFhwnUxWAMrje1FBpaZ2IM F89Q4JRD4c/Wv/4Hz9mqQo7S/5J/doQLxLyeFYtC/fEqm65cLD7+1sJXZo5av/zJi9ch EwDdjJaNlI7l7UV9uLiSrg2KVw7j8m5GQzVATzY7rDVvKisw68kL9kH+jTSw+HbdplFl trvNXeM264Jp27yYMlYkfDBxcLJgxIplM7nWWEnCHbb0oRK6tycTpV9dr2eqetB9vKG4 aV7h1f7yYdR51Gv5DryU267PsSSTnObwCzqRKlyGawDVpeFUGqSKlybcjLU/sDdmTIdv U7zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:cc:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=rRo7iKWn0W4dxYINKDgU6NK/eCy+Sd+S26eku4plTYk=; b=p9unD/MUQvR65pAm/EhXRwHYptjEr/9wvtJGrk3p47XNdkNKMg8xQoW/Po7Hqed7CX E3AA/+2Me+2qS9LSatrgb52vHOeyV0W9SlzfFhlsRDzhHRisZaf3Kb6LxufKQlDa3Ac8 fq2/48DyFyHu/eIZZMiqok4mffqAk8a5yd6onjynzbpBrHUAjtxCBbUxplbsF0mJLkKG nj+jXglGOJDijq7FmJmYZyA31x4sJfSW8I1UiNRLYU1f4l2OEPyGA1178fLuEbx0KZIJ kjBRHaTWxtdZ6of1QvsGashVztvR8rTSBjXl3TBd86VjcN26vPhiuAz2uS8Fg2+EBhXc Dgbw== X-Gm-Message-State: APjAAAWsU4JgGZ84CP7kcdx4Kp2IjvjEzWJqQLHq2yIyLYmUxUFjOwAA a38pVMampAs7fdPJvTcf+CbDNGRVsKM= X-Google-Smtp-Source: APXvYqxV85SqCaLGjQDhH8/cizPIFXRhg608N7JHrINw+AZ+YjeZELLkuYFj6xE5cJto7OKBmliHeA== X-Received: by 2002:a37:bd0:: with SMTP id 199mr9617049qkl.207.1570711311925; Thu, 10 Oct 2019 05:41:51 -0700 (PDT) Received: from [10.24.0.14] ([173.244.200.125]) by smtp.googlemail.com with ESMTPSA id a3sm2647979qtn.97.2019.10.10.05.41.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 Oct 2019 05:41:50 -0700 (PDT) Subject: Re: Case Insensitive Comparison with Postgres 12 To: "Psql_General (E-mail)" References: <9ad4f42faa10f1aa4e81e3ed8160d36d0d39856a.camel@cybertec.at> From: "Igal @ Lucee.org" Cc: Laurenz Albe , =?UTF-8?Q?Pavel_K=c5=99ehula?= Message-ID: <9803fc4d-7fe4-33f3-014e-defdfcc59873@lucee.org> Date: Thu, 10 Oct 2019 05:41:47 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <9ad4f42faa10f1aa4e81e3ed8160d36d0d39856a.camel@cybertec.at> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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