Re: simplify regular expression locale global variables

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Andreas Karlsson <andreas@proxel.se>, pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Jeff Davis <pgsql@j-davis.com>
Date: 2024-12-03T16:06:30Z
Lists: pgsql-hackers

Attachments

On 25.10.24 10:16, Andreas Karlsson wrote:
> On 10/15/24 8:12 AM, Peter Eisentraut wrote:
>> We currently have
>>
>>      static PG_Locale_Strategy pg_regex_strategy;
>>      static pg_locale_t pg_regex_locale;
>>      static Oid  pg_regex_collation;
>>
>> but after the recent improvements to pg_locale_t handling, we don't 
>> need all three anymore.  All the information we have is contained in 
>> pg_locale_t, so we just need to keep that one.  This allows us to 
>> structure the locale-using regular expression code more similar to 
>> other locale-using code, mainly by provider, avoiding another layer 
>> that is specific only to the regular expression code.  The first patch 
>> implements that.
> 
> Jeff Davis has a patch which also fixes this while refactoring other 
> stuff too which I prefer over your patch since it also cleans up the 
> collation code in general.
> 
> https://www.postgresql.org/message- 
> id/2830211e1b6e6a2e26d845780b03e125281ea17b.camel%40j-davis.com

That patch set looks like a good direction.

But it doesn't remove pg_regex_collation, only pg_regex_strategy.  So I 
have split my v2 into two patches, the first removes pg_regex_collation 
and the second removes pg_regex_strategy.  The first patch is useful on 
its own, I think; the second one will presumably be replaced by the 
other patch series above.

Commits

  1. Remove pg_regex_collation