pgsql: downcase_identifier(): use method table from locale provider. - Mailing list pgsql-committers

From Jeff Davis
Subject pgsql: downcase_identifier(): use method table from locale provider.
Date
Msg-id E1vVegh-0019Bu-0g@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/87b2968df0f866aaccb6ba69adf284e3c4a79454

Modified Files
--------------
src/backend/parser/scansup.c              | 36 +++++++++++--------------------
src/backend/utils/adt/pg_locale.c         | 20 +++++++++++++++++
src/backend/utils/adt/pg_locale_builtin.c |  2 ++
src/backend/utils/adt/pg_locale_icu.c     | 36 ++++++++++++++++++++++++++++++-
src/backend/utils/adt/pg_locale_libc.c    | 33 ++++++++++++++++++++++++++++
src/include/utils/pg_locale.h             |  5 +++++
6 files changed, 107 insertions(+), 25 deletions(-)


pgsql-committers by date:

Previous
From: Jeff Davis
Date:
Subject: pgsql: ltree: fix case-insensitive matching.
Next
From: Michael Paquier
Date:
Subject: pgsql: Remove useless code in InjectionPointAttach()