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 1uSIDv-005oF6-Mm for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Jun 2025 16:34:47 +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 1uSICv-00Cnsb-Gu for pgsql-hackers@arkaria.postgresql.org; Thu, 19 Jun 2025 16:33:46 +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.94.2) (envelope-from ) id 1uSICv-00CnsT-3w for pgsql-hackers@lists.postgresql.org; Thu, 19 Jun 2025 16:33:45 +0000 Received: from mail-pl1-x630.google.com ([2607:f8b0:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uSICt-002v7Z-2t for pgsql-hackers@postgresql.org; Thu, 19 Jun 2025 16:33:44 +0000 Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-234c5b57557so9745835ad.3 for ; Thu, 19 Jun 2025 09:33:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1750350823; x=1750955623; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=R9FAR17/w3InJmv5RQBxJ+J57uaSMwI80vtAIixuHT8=; b=S20JwCAgj0++t2ELc85Jxg+vbOQ8A9A0l+sqimPnzhtVaOP8ndMmVxGCL1QuLrIXQX kiMqgUbhc4YQXEJCTyicY7maAX8ZktJuoyTs3BnDO5wn8wutplD5LXP7xg0FPPd19W7o C7WwGrkYyDeQ8bj2QiFIa/ISMDpGQb4XsLjNauZBxymqc6gs6KeEvCdRq1OVhyuzYT1L EN8R2VcNpXdf3Kw/uNPi9gWsS/UEtAjOXCQgxRs0CilZF7fwKv4VgtU+lbcPtJvYCw2z h8UuGV8UCgFloY//Lb5vEyRHYXPommV+D8MuUtDxp+qrHCyWCJE3BaJT97qr6lBiKFiw ghLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750350823; x=1750955623; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=R9FAR17/w3InJmv5RQBxJ+J57uaSMwI80vtAIixuHT8=; b=Iw0BLK8C1X2VByVqxd1DGB4iWgMjmSZvs4CCDLGhvolBpaND7s6aJd3GAGUD45k9Kr 8OWPW8YmaQoySz7+selfzMK8IsillrewHlxSwOLlLFLYWtQdNAayVOYZGOQAK25bfPGW Jq92f0WLnpwKxf807rSkNWmv+TJiiGuHjRy1ixoVjnSuWh+ydaQY22HLadOQGPxf8jyg 74jRZO1fTyQtta7Q3WcF0rKuZALMMeZZwf/ZfBfKuhMmmFQI4ykKhO50KEtQCd6aY1f5 TPwzA5yDGcPaQZW0t2HDE+LAzSVLApWm/Ejse/v2kd6gVdOXz6d5TBSXQN8LbsmrtTsm jJpQ== X-Forwarded-Encrypted: i=1; AJvYcCV8kI20x+zjrYRu7+7Cq3g9XDz/DyiZJvoJCktlBAuwS6qFc9DBgi+61VWrv+WgURLeWUtihiPtOOEaCNmh@postgresql.org X-Gm-Message-State: AOJu0YzRdcejTMD9ggeFfGGFKmGWdTb/CuMASIIgDDEkhkqPSCBXONMQ iX/CMNJo3PvTVc8+CQk+dtdX1wn1dlLYsmSDtL5UAzJxkvZvD7g2+eJ1H8EVyzOZaA== X-Gm-Gg: ASbGncv54rf28LjMLhtb7T/qDG49CY2FdcEDBeXzCCgvaYJw9DuzJDujHrkbPfV5fjJ azPdRK/i8nAHxiq2K/ixdiGtdqnQqdDTFZeBsz0RXd+eeMdi+QCorI33ZwNLTme2wR8ojQ6DJ1t DsAYAGMIR/EVIIWtgEwrRn+hsbkcNl4P0kr6etGS+nBjedsxT8QF/1mEbegIru3of1pfKc9sKst 0NQT05Co81YxK7HpH2mlFTjnPG1zlGgc7EA3FZcXZe2NGRWijGqGsViFtHUzTb/0h5np3POFOsY g+Ihneq3PbJFmsGD6lRYaHUz0FCRKsQUuPCc/DVnIrtgRwdl2GGUpX2mKxFfLpga3UJoWUIF0H9 mEEiWR4eWITn5J1G6PfQetEWPPAoJqMD+ X-Google-Smtp-Source: AGHT+IFl7qaANRFi2Sy6Pt2eFjmp8uPCIPbATVed3UcavcBb8mxEHqYvfBRo4Nj402eHMK+spTerjQ== X-Received: by 2002:a17:902:ccc2:b0:234:a139:1203 with SMTP id d9443c01a7336-2366b3c5ac7mr362225755ad.32.1750350822986; Thu, 19 Jun 2025 09:33:42 -0700 (PDT) Received: from jeff-ws-bridge.lan (c-76-102-242-158.hsd1.ca.comcast.net. [76.102.242.158]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2365d88c029sm121697695ad.26.2025.06.19.09.33.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jun 2025 09:33:42 -0700 (PDT) Message-ID: Subject: Re: Add CASEFOLD() function. From: Jeff Davis To: Thom Brown , Peter Eisentraut Cc: Vik Fearing , Joe Conway , Ian Lawrence Barwick , PostgreSQL-development Date: Thu, 19 Jun 2025 09:33:41 -0700 In-Reply-To: References: <47716a78-eb0b-4728-8991-fc0d958a01c9@joeconway.com> <36f69fa9-db3f-44a1-8c8a-95ff09704a9c@postgresfriends.org> <692d28a2-d5f8-4db5-a3ad-c7db9bab522f@postgresfriends.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2025-06-19 at 16:36 +0100, Thom Brown wrote: > Ease of use, perhaps. It seems easier to use: >=20 > column_name cftext >=20 > rather than: >=20 > CREATE COLLATION case_insensitive_collation ( > =C2=A0=C2=A0=C2=A0 PROVIDER =3D icu, > =C2=A0=C2=A0=C2=A0 LOCALE =3D 'und-u-ks-level2', > =C2=A0=C2=A0=C2=A0 DETERMINISTIC =3D FALSE > ); We could auto-create such a collation at initdb time for ICU-enabled builds. > But I see the arguments against it. It creates an unnecessary > dependency on an extension, and if someone wants to ignore both case > and accents, they may resort to using 2 extensions (citext + > unaccent) > when none are needed. There are at least three ways to do case insensitivity (or other kinds of equivalence): * Explicit function calls in queries, as well as index and constraint definitions. E.g. expression index on LOWER(), queries that explicitly do "LOWER(x) =3D ..." * Wrap those function calls up in a separate data type, like citext. * Non-deterministic collations. Given that we have collations, which are a way of organizing alternate behaviors for existing data types, I'm not sure I see the need for creating an entirely separate data type. > I guess I don't feel strongly about it either > way. Are you a user of citext? I'm genuinely interested in the use cases, and whether the separate-data-type approach has merits that are missing in the other approaches. Regards, Jeff Davis