Re: Add CASEFOLD() function.

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Vik Fearing <vik@postgresfriends.org>, Jeff Davis <pgsql@j-davis.com>, Joe Conway <mail@joeconway.com>, Ian Lawrence Barwick <barwick@gmail.com>
Cc: pgsql-hackers@postgresql.org
Date: 2025-06-19T14:47:10Z
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.

On 17.06.25 17:37, Vik Fearing wrote:
> For <fold> (which includes LOWER() and UPPER()), the text says in 
> Section 6.35 GR 7.e:
> 
> 
> If the character set of <character factor> is UTF8, UTF16, or UTF32, 
> then FR is replaced by
>      Case:
>          i) If the <search condition> S IS NORMALIZED evaluates to True, 
> then NORMALIZE (FR)
>          ii) Otherwise, FR.
> 
> 
> Here, FR is the result of the function and S is its argument.
> 
> 
> It does not appear to me that our LOWER and UPPER functions obey this 
> rule, so there is a valid argument that we should continue to ignore it. 
> Or, we can say that we have at least one of three compliant.

The SQL standard also says in a few other places that normalization 
should be applied, and we do none of those, so this is probably not a 
reason to change CASEFOLD at this point.