downcase_identifier(): use method table from locale provider

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: downcase_identifier(): use method table from locale provider
Date: 2025-10-21 18:28:04
Message-ID: 5f95b81af1e81b28b8a9ac5929f199b2f4091fdf.camel@j-davis.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

Attachment Content-Type Size
v1-0001-downcase_identifier-use-method-table-from-locale-.patch text/x-patch 10.8 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2025-10-21 18:40:09 Re: Speed up COPY FROM text/CSV parsing using SIMD
Previous Message Sami Imseih 2025-10-21 18:26:30 Re: Skip unregistered custom kinds on stats load