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?