Add CASEFOLD() function.

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-hackers@postgresql.org
Date: 2024-12-12T09:00:15Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix PDF doc build.

  2. Add SQL function CASEFOLD().

  3. Add support for Unicode case folding.

Attachments

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