Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lT2Xu-0000sv-9M for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Apr 2021 13:12:06 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lT2Xr-000286-OD for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Apr 2021 13:12:03 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lT2Xr-00027x-HE for pgsql-hackers@lists.postgresql.org; Sun, 04 Apr 2021 13:12:03 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lT2Xo-0007iT-AG for pgsql-hackers@postgresql.org; Sun, 04 Apr 2021 13:12:02 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 8C8E6256E2A4A for ; Sun, 4 Apr 2021 06:11:57 -0700 (MST) Date: Sun, 4 Apr 2021 06:11:57 -0700 (MST) From: Jim Finnerty To: pgsql-hackers@postgresql.org Message-ID: <1617541917530-0.post@n3.nabble.com> In-Reply-To: <3edec684-85a8-40b7-a47c-16c54d6eb54f@manitou-mail.org> References: <440ec733-d068-46d3-9756-f5f692aba7c8@manitou-mail.org> <99818c53-d10f-eb0b-bcb1-fd5d60f6dd96@2ndquadrant.com> <693ad06d-db9a-4e59-8131-f823483c5893@manitou-mail.org> <1616528764665-0.post@n3.nabble.com> <1616618498263-0.post@n3.nabble.com> <54ef5bfe-043e-4328-9d70-5818789838f4@manitou-mail.org> <1616677789675-0.post@n3.nabble.com> <1617475666203-0.post@n3.nabble.com> <3edec684-85a8-40b7-a47c-16c54d6eb54f@manitou-mail.org> Subject: Re: insensitive collations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk you were exactly right. With client_encoding set to UTF8 it now works correctly. the transformation to do the LIKE or ILIKE on a nondeterministic ICU collation CI_AS for which there is an otherwise identical deterministic collation CS_AS is as shown below:=20 SELECT * FROM locations WHERE location LIKE 'midi-Pyr_n%=C3=A9es'; -- what= we want to do ERROR: nondeterministic collations are not supported for LIKE -- explicitly collate with the CS_AS collation and then use ILIKE to get th= e desired CI_AS behavior: -- note that the single-character wildcard '_' matches either e or =C3=A9, = as expected SELECT * FROM locations WHERE location COLLATE SQL_Latin1_General_CP1_CS_AS ILIKE 'midi-Pyr_n%=C3=A9es'; location =20 --------------- Midi-Pyr=C3=A9n=C3=A9es midi-Pyr=C3=A9n=C3=A9es midi-Pyren=C3=A9es (3 rows) EXPLAIN SELECT * FROM locations WHERE location COLLATE SQL_Latin1_General_CP1_CS_AS ILIKE 'midi-Pyr_n%=C3=A9es'; QUERY PLAN = =20 ---------------------------------------------------------------------------= ---- Bitmap Heap Scan on locations (cost=3D8.90..20.77 rows=3D1 width=3D516) Filter: ((location)::text ~~* 'midi-Pyr_n%=C3=A9es'::text) -> Bitmap Index Scan on location_index (cost=3D0.00..8.89 rows=3D150 width=3D0) (3 rows) ----- Jim Finnerty, AWS, Amazon Aurora PostgreSQL -- Sent from: https://www.postgresql-archive.org/PostgreSQL-hackers-f1928748.h= tml