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.96) (envelope-from ) id 1x4dbA-007IA4-1D for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Sep 2026 12:09:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1x4db9-005Swd-1G for pgsql-bugs@arkaria.postgresql.org; Thu, 10 Sep 2026 12:09:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x3puB-0058an-0c for pgsql-bugs@lists.postgresql.org; Tue, 08 Sep 2026 07:06:07 +0000 Received: from mahout.postgresql.org ([2001:4800:3e1:1::227]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1x3pu9-00000004YPq-0cB0 for pgsql-bugs@lists.postgresql.org; Tue, 08 Sep 2026 07:06:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Message-ID:Date:Reply-To:Cc:From:To:Subject: Content-Transfer-Encoding:MIME-Version:Content-Type:Sender:Content-ID: Content-Description:In-Reply-To:References; bh=JabkdF+KGd7QRqU/KeoGM+ZDxWwi9/zEHaDQCAkRoVk=; b=1oRjO2vBaWqzEHrPJxvI1VUuLX BjVmYbVpVEM62ovOAtwUINS8eAUbgi70I4E2RnlBddsFXD0gI2K2yY/dmy8z+Jlviz/ybWQX7mnHf 5ExlyH8Ecl1VWudzmKpxUadT+MhOWY9swNKfs5QdEGwChi8/rvabE8usO5siF2+3nT1W/W7QY5yVh ADIuNGDa4zBT7dfYAyvrL1SAwcFnD+SmWjXqR7CKb3DchGnrt79xyKA1JULMUWoRGkSj9iy2ZsbPB Wj+JT70gauygD5MufPXxKtNioLV8Y7KsjM8lfOlcE+tuWwiJD6wj8pvDYA0FqRdh8uDgy3gNB6vBd 3X0ytQIQ==; Received: from wrigleys.postgresql.org ([2a02:16a8:dc51::60]) by mahout.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1x3pu8-00DojR-33 for pgsql-bugs@lists.postgresql.org; Tue, 08 Sep 2026 07:06:04 +0000 Received: from localhost ([127.0.0.1] helo=wrigleys.postgresql.org) by wrigleys.postgresql.org with esmtp (Exim 4.98.2) (envelope-from ) id 1x3pu7-00000001Ue9-3rOj for pgsql-bugs@lists.postgresql.org; Tue, 08 Sep 2026 07:06:03 +0000 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Subject: BUG #19681: ILIKE rejected on nondeterministic collations while LIKE works To: pgsql-bugs@lists.postgresql.org From: PG Bug reporting form Cc: 303677365@qq.com Reply-To: 303677365@qq.com, pgsql-bugs@lists.postgresql.org Date: Tue, 08 Sep 2026 07:05:18 +0000 Message-ID: <19681-074ed6100d92cc5b@postgresql.org> X-Auto-Response-Suppress: All Auto-Submitted: auto-generated List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk The following bug has been logged on the website: Bug reference: 19681 Logged by: chunling qin Email address: 303677365@qq.com PostgreSQL version: 18.6 Operating system: x86_64 Description: =20 On a column with a nondeterministic (case-insensitive) collation, the pattern-matching operators split into two contradictory groups: CREATE COLLATION ci (provider =3D icu, locale =3D 'und-u-ks-level2', deterministic =3D false); CREATE TABLE ndt(b text COLLATE ci); INSERT INTO ndt VALUES ('a'),('A'),('str'),('STR'),('Hello'); Group 1 =E2=80=94 silently supported (documented for LIKE): SELECT count(*) FROM ndt WHERE b LIKE 's%'; -- 2 (matches 'str' and 'STR') SELECT count(*) FROM ndt WHERE b LIKE 'str'; -- 2 SELECT count(*) FROM ndt WHERE b IN ('str'); -- 2 SELECT count(*) FROM ndt WHERE b =3D 'str'; -- 1 SELECT count(*) FROM ndt WHERE upper(b) LIKE 'S%'; -- 2 (upper+LIKE: ILIKE's definition!) SELECT b LIKE 'str' COLLATE ci FROM ndt WHERE b =3D 'STR'; -- true (documented example form) Group 2 =E2=80=94 rejected with an error: SELECT count(*) FROM ndt WHERE b ILIKE 's%'; -- ERROR: nondeterministic collations are not supported for ILIKE SELECT b ILIKE 'str' COLLATE ci FROM ndt; -- ERROR: same SELECT count(*) FROM ndt WHERE b ~ '^s'; -- ERROR: nondeterministic collations are not supported for regular expressions SELECT count(*) FROM ndt WHERE b SIMILAR TO 's%'; -- ERROR: same The documentation (func-matching.sgml) states that LIKE supports nondeterministic collations and that SIMILAR TO / POSIX regex do not =E2=80= =94 but says nothing about ILIKE. Meanwhile ILIKE's documented definition is exactly "matches LIKE, but case-insensitively" (implemented as case folding + LIKE), and that folding path works fine on the same column (upper(b) LIKE 'S%' returns 2 rows). The citext extension =E2=80=94 the other case-insensitive = subsystem =E2=80=94 accepts ILIKE without error on its columns, making the ND-collati= on rejection of the same operator even more inconsistent.