Add SQL function CASEFOLD().
Jeff Davis <jdavis@postgresql.org>
Add SQL function CASEFOLD(). Useful for caseless matching. Similar to LOWER(), but avoids edge-case problems with using LOWER() for caseless matching. For collations that support it, CASEFOLD() handles characters with more than two case variations or multi-character case variations. Some characters may fold to uppercase. The results of case folding are also more stable across Unicode versions than LOWER() or UPPER(). Discussion: https://postgr.es/m/a1886ddfcd8f60cb3e905c93009b646b4cfb74c5.camel%40j-davis.com Reviewed-by: Ian Lawrence Barwick
Files
| Path | Change | +/− |
|---|---|---|
| doc/src/sgml/func.sgml | modified | +44 −2 |
| src/backend/utils/adt/formatting.c | modified | +69 −0 |
| src/backend/utils/adt/oracle_compat.c | modified | +16 −0 |
| src/backend/utils/adt/pg_locale_builtin.c | modified | +10 −0 |
| src/backend/utils/adt/pg_locale.c | modified | +24 −0 |
| src/backend/utils/adt/pg_locale_icu.c | modified | +58 −0 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.dat | modified | +3 −0 |
| src/include/utils/formatting.h | modified | +1 −0 |
| src/include/utils/pg_locale.h | modified | +3 −0 |
| src/test/regress/expected/collate.icu.utf8.out | modified | +24 −0 |
| src/test/regress/expected/collate.utf8.out | modified | +14 −0 |
| src/test/regress/sql/collate.icu.utf8.sql | modified | +5 −0 |
| src/test/regress/sql/collate.utf8.sql | modified | +6 −0 |
Documentation touched
Discussion
- Add CASEFOLD() function. 33 messages · 2024-12-12 → 2025-06-19