| From: | Peter Eisentraut <peter(at)eisentraut(dot)org> |
|---|---|
| To: | Jeff Davis <pgsql(at)j-davis(dot)com>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
| Cc: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org |
| Subject: | Re: Remaining dependency on setlocale() |
| Date: | 2025-11-12 18:59:33 |
| Message-ID: | b1ea6756-279a-4924-9146-e125af2057b2@eisentraut.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On 29.10.25 01:19, Jeff Davis wrote:
> On Wed, 2025-07-23 at 19:11 -0700, Jeff Davis wrote:
>> On Fri, 2025-07-11 at 11:48 +1200, Thomas Munro wrote:
>>> On Fri, Jul 11, 2025 at 6:22 AM Jeff Davis <pgsql(at)j-davis(dot)com>
>>> wrote:
>>>> I don't have a great windows development environment, and it
>>>> appears CI
>>>> and the buildfarm don't offer great coverage either. Can I ask
>>>> for
>>>> a
>>>> volunteer to do the windows side of this work?
>>>
>>> Me neither but I'm willing to help with that, and have done lots of
>>> closely related things through trial-by-CI...
>
> Attached a new patch series, v6.
>
> Rather than creating new global locale_t objects, this series (along
> with a separate patch for NLS[1]) removes the dependency on the global
> LC_CTYPE entirely. It's a bunch of small patches that replace direct
> calls to tolower()/toupper() with calls into the provider.
>
> An assumption of these patches is that, in the UTF-8 encoding, the
> logic in pg_tolower()/pg_toupper() is equivalent to
> pg_ascii_tolower()/pg_ascii_toupper().
I'm getting a bit confused by all these different variant function
names. Like we have now
tolower
TOLOWER
char_tolower
pg_tolower
pg_strlower
pg_ascii_tolower
downcase_identifier
and maybe more, and upper versions.
This patch set makes changes like
- else if (IS_HIGHBIT_SET(ch2) && isupper(ch2))
- ch2 = tolower(ch2);
+ else if (IS_HIGHBIT_SET(ch2))
+ ch2 = TOLOWER(ch2);
So there is apparently some semantic difference between tolower() and
TOLOWER(), which is represented by the fact that the function name is
all upper case? Actually, it's a macro and could mean different things
in different contexts.
And there is very little documentation accompanying all these different
functions. For example, struct collate_methods and struct ctype_methods
contain barely any documentation at all.
Many of these issues are pre-existing, but I just figured it has reached
a point where we need to do something about it.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeff Davis | 2025-11-12 18:59:35 | Re: Remaining dependency on setlocale() |
| Previous Message | Peter Eisentraut | 2025-11-12 18:41:58 | Re: Remaining dependency on setlocale() |