public inbox for [email protected]  
help / color / mirror / Atom feed
From: Alvaro Herrera <[email protected]>
To: Peter Eisentraut <[email protected]>
Cc: pgsql-hackers <[email protected]>
Subject: Re: simplify regular expression locale global variables
Date: Tue, 15 Oct 2024 12:08:01 +0200
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

On 2024-Oct-15, Peter Eisentraut wrote:

> @@ -253,8 +241,9 @@ pg_set_regex_collation(Oid collation)
>  		 * catalog access is available, so we can't call
>  		 * pg_newlocale_from_collation().
>  		 */
> +		static struct pg_locale_struct dummy_locale = {.ctype_is_c = true};
> +
> +		locale = &dummy_locale;
>  	}
>  	else
>  	{
> @@ -264,121 +253,80 @@ pg_set_regex_collation(Oid collation)
>  			ereport(ERROR,
>  					(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
>  					 errmsg("nondeterministic collations are not supported for regular expressions")));
> [...]
>  	}
>  
>  	pg_regex_locale = locale;
>  }

Hmm, is it valid to make pg_regex_locale point to a function-local
static here?  The lifetime of this static is not clear to me, and I
think this pattern works with at least some compilers, but I remember
comments on previous patch review threads that this pattern isn't
kosher.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/






view thread (3+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: simplify regular expression locale global variables
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox