Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1mlc-00EsST-5A for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 12:39:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s1mlY-006DUG-Tt for pgsql-hackers@arkaria.postgresql.org; Tue, 30 Apr 2024 12:39:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1mlY-006DU7-KU for pgsql-hackers@lists.postgresql.org; Tue, 30 Apr 2024 12:39:25 +0000 Received: from dverite2024.planet-service.net ([185.16.44.252] helo=mail.verite.pro) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1mlS-000qVI-9G for pgsql-hackers@postgresql.org; Tue, 30 Apr 2024 12:39:24 +0000 Received: by mail.verite.pro (Postfix, from userid 1000) id 16C542C0CF3; Tue, 30 Apr 2024 14:39:16 +0200 (CEST) Content-Type: text/plain; charset="iso-8859-15" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: Support LIKE with nondeterministic collations From: "Daniel Verite" To: "Peter Eisentraut" Cc: "pgsql-hackers" In-Reply-To: <700d2e86-bf75-4607-9cf2-f5b7802f6e88@eisentraut.org> Date: Tue, 30 Apr 2024 14:39:11 +0200 Message-Id: X-Mailer: Manitou v1.7.3 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Peter Eisentraut wrote: > This patch adds support for using LIKE with nondeterministic > collations. So you can do things such as >=20 > col LIKE 'foo%' COLLATE case_insensitive Nice! > The pattern is partitioned into substrings at wildcard characters > (so 'foo%bar' is partitioned into 'foo', '%', 'bar') and then then > whole predicate matches if a match can be found for each partition > under the applicable collation Trying with a collation that ignores punctuation: postgres=3D# CREATE COLLATION "ign_punct" ( provider =3D 'icu', locale=3D'und-u-ka-shifted', deterministic =3D false ); postgres=3D# SELECT '.foo.' like 'foo' COLLATE ign_punct; ?column?=20 ---------- t (1 row) postgres=3D# SELECT '.foo.' like 'f_o' COLLATE ign_punct; ?column?=20 ---------- t (1 row) postgres=3D# SELECT '.foo.' like '_oo' COLLATE ign_punct; ?column?=20 ---------- f (1 row) The first two results look fine, but the next one is inconsistent. Best regards, --=20 Daniel V=E9rit=E9 https://postgresql.verite.pro/ Twitter: @DanielVerite