Add CASEFOLD() function.

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Add CASEFOLD() function.
Date: 2024-12-12 09:00:15
Message-ID: a1886ddfcd8f60cb3e905c93009b646b4cfb74c5.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Unicode case folding is a way to convert a string to a canonical case
for the purpose of case-insensitive matching.

Users have long used LOWER() for that purpose, but there are a few edge
case problems:

* Some characters have more than two cased forms, such as "Σ" (U+03A3),
which can be lowercased as "σ" (U+03C3) or "ς" (U+03C2). The CASEFOLD()
function converts all cased forms of the character to "σ".

* The character "İ" (U+0130, capital I with dot) is lowercased to "i",
which can be a problem in locales that don't expect that.

* If new lower case characters are added to Unicode, the results of
LOWER() may change.

The CASEFOLD() function solves these problems.

Patch attached.

--
Jeff Davis
PostgreSQL Contributor Team - AWS

Attachment Content-Type Size
v1-0001-Refactor-case-mapping-into-provider-specific-file.patch text/x-patch 37.9 KB
v1-0002-Add-support-for-Unicode-case-folding.patch text/x-patch 569.3 KB
v1-0003-Add-SQL-function-FOLDCASE.patch text/x-patch 13.9 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Önder Kalacı 2024-12-12 09:28:22 Allow FDW extensions to support MERGE command via CustomScan
Previous Message Andrei Lepikhov 2024-12-12 08:40:50 Re: Add Postgres module info