]> git.ipfire.org Git - thirdparty/postgresql.git/commit
downcase_identifier(): use method table from locale provider.
authorJeff Davis <jdavis@postgresql.org>
Tue, 16 Dec 2025 23:32:41 +0000 (15:32 -0800)
committerJeff Davis <jdavis@postgresql.org>
Tue, 16 Dec 2025 23:32:41 +0000 (15:32 -0800)
commit87b2968df0f866aaccb6ba69adf284e3c4a79454
tree83669f96e2198bc8dda0666e7e8b0805c77f95a9
parent7f007e4a044a713df5320fca09621d6ba8e632ba
downcase_identifier(): use method table from locale provider.

Previously, libc's tolower() was always used for lowercasing
identifiers, regardless of the database locale (though only characters
beyond 127 in single-byte encodings were affected). Refactor to allow
each provider to supply its own implementation of identifier
downcasing.

For historical compatibility, when using a single-byte encoding, ICU
still relies on tolower().

One minor behavior change is that, before the database default locale
is initialized, it uses ASCII semantics to downcase the
identifiers. Previously, it would use the postmaster's LC_CTYPE
setting from the environment. While that could have some effect during
GUC processing, for example, it would have been fragile to rely on the
environment setting anyway. (Also, it only matters when the encoding
is single-byte.)

Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Discussion: https://postgr.es/m/450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com
src/backend/parser/scansup.c
src/backend/utils/adt/pg_locale.c
src/backend/utils/adt/pg_locale_builtin.c
src/backend/utils/adt/pg_locale_icu.c
src/backend/utils/adt/pg_locale_libc.c
src/include/utils/pg_locale.h