Re: tiny step toward threading: reduce dependence on setlocale()

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Jeff Davis <pgsql(at)j-davis(dot)com>, Andreas Karlsson <andreas(at)proxel(dot)se>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: tiny step toward threading: reduce dependence on setlocale()
Date: 2024-08-13 15:11:50
Message-ID: cfe99144-e1a3-458b-93c6-09b2eac1746e@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm wondering if after this patch series, lc_collate_is_c() and
lc_ctype_is_c() are still useful.

They used to be completely separate from pg_newlocale_from_collation(),
but now they are just mostly a thin wrapper around it. Except there is
some hardcoded handling of C_COLLATION_OID and POSIX_COLLATION_OID. Do
we care about that?

In many places, the notational and structural complexity would be
significantly improved if we changed code like

if (pg_collate_is_c(colloid))
{
...
}
else
{
pg_locale_t locale = pg_newlocale_from_collation(colloid);

if (locale->provider == ...)
{
...
}

to more like

pg_locale_t locale = pg_newlocale_from_collation(colloid);

if (locale->collate_is_c)
{
...
}
else if (locale->provider == ...)
...
}
...

However, it's not clear whether the hardcoded handling of some
collations is needed for performance parity or perhaps some
bootstrapping reasons. It would be useful to get that cleared up.
Thoughts?

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Imseih (AWS), Sami 2024-08-13 15:47:51 Re: Restart pg_usleep when interrupted
Previous Message Nathan Bossart 2024-08-13 15:09:57 Re: Restart pg_usleep when interrupted