downcase_identifier(): use method table from locale provider
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
Attachments:
On Tue, 2025-10-21 at 11:28 -0700, Jeff Davis wrote:
The attached patch refactors downcase_identifier() to use a method
from
the locale provider.
For now, I'm retracting this patch, instead opting for the narrower
change in the patch series here:
/messages/by-id/d9657a6e51aa20702447bb2386b32fea6218670f.camel@j-davis.com
We may want a this downcase_identifier() method later as a step toward
better SQL standard support for identifier downcasing. But I'm not
focused on that problem right now.
Regards,
Jeff Davis