The attached patch refactors downcase_identifier() to use a method from
the locale provider.
The main advantage is that we can bring the tolower() call into the
libc provider, and make it tolower_l() to avoid the global LC_CTYPE
dependency. It's also generally aligned with the idea that provider-
specific behavior should be defined by the provider rather than the
caller, and might enable us in the future to improve support for
Unicode-aware identifier case folding.
Unfortunately, ICU also currently uses tolower() for single-byte
encodings, which seems to have been a historical oversight. This patch
doesn't correct that, which can be done in a separate patch.
There's a theoretical behavior change if downcase_identifier is called
before the database default locale is initialized, but I don't see a
practical problem there. Other than that, there should be no behavior
changes.
Regards,
Jeff Davis