Re: tiny step toward threading: reduce dependence on setlocale() - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: tiny step toward threading: reduce dependence on setlocale()
Date
Msg-id cfe99144-e1a3-458b-93c6-09b2eac1746e@eisentraut.org
Whole thread Raw
In response to Re: tiny step toward threading: reduce dependence on setlocale()  (Jeff Davis <pgsql@j-davis.com>)
Responses Re: tiny step toward threading: reduce dependence on setlocale()
List 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?




pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: Restart pg_usleep when interrupted
Next
From: "Imseih (AWS), Sami"
Date:
Subject: Re: Restart pg_usleep when interrupted