Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0eTL-00CW9I-2j for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Oct 2024 10:08:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1t0eTI-005RVv-E7 for pgsql-hackers@arkaria.postgresql.org; Tue, 15 Oct 2024 10:08:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0eTH-005RVm-Qx for pgsql-hackers@lists.postgresql.org; Tue, 15 Oct 2024 10:08:08 +0000 Received: from fhigh-a5-smtp.messagingengine.com ([103.168.172.156]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1t0eTF-000zBm-LG for pgsql-hackers@postgresql.org; Tue, 15 Oct 2024 10:08:06 +0000 Received: from phl-compute-10.internal (phl-compute-10.phl.internal [10.202.2.50]) by mailfhigh.phl.internal (Postfix) with ESMTP id 193161140083; Tue, 15 Oct 2024 06:08:04 -0400 (EDT) Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-10.internal (MEProxy); Tue, 15 Oct 2024 06:08:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; t=1728986884; x= 1729073284; bh=wcJR4v6tDLaziYYEH2ClZdx6j1M89PwDhOpv4a7XrXI=; b=k mrsqQwVEMxncTGPQI9qlS+qlmwSMYHyA+J20SIdaxglrgZ5vTnpbExNvdcYORfCy F8PzBzgGU5UGsAXK1fig7bjfXJaNDAjTUbItahCXGXukZIBznMvpuUFlduEby1pe p7ag7yVTY5Zio0A9cfN7Qudxvq7erOrf903eH9BaH51cxEBrSIDUVWfO8cUOTd3r kdCZFqi2XxkWqPQsXfJNPItYpkKscu4ccqoV6FVafPj/KHzWlNN565rwPWio4/ys Sy2jW+bqf7ZTRx2Fm+Ywxl63gH8O+3E+dAUbNA6gBcPo4/cI055w4xuh12T35c10 HGKPVCulIV/COjjU6vznw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrvdegjedgvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnh htshculddquddttddmnecujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeen ucfhrhhomheptehlvhgrrhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhh drnhhoqdhiphdrohhrgheqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffh jeejhffgieeuueekjeekfffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrph hrihhsvggusgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgr ihhlfhhrohhmpegrlhhvhhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhgpdhnsggprh gtphhtthhopedvpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehpvghtvghrsegv ihhsvghnthhrrghuthdrohhrghdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhsse hpohhsthhgrhgvshhqlhdrohhrgh X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 15 Oct 2024 06:08:03 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1728986881; bh=9Iob6AnVheajA3a8COzuCEAbI1GI3RvWerLEzXowCOs=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=PKVVLyR7BOtgBcMFM7lxP950wGVwIPuAT9l7Hl9LeuRa91YCHdGEeGyUJRZ4M6Bra bJZMAcc43FcE0JICqjVkB89YLxZ76BzllZoJL/Qlwz51COBAtiHGc+h2EMba9LgptS 04XT502jpyUXlnC1518VUhT8OqDW+3IYmzDwwf5/rxS7sKB8GX0WEdw+v0/4W/3USp Zig/eL44FHekbhbfJOeZVdkffn20W5Q95A6Cag+UM+TxoGPv6BfkghKcigFKDri/7z 6TSTJzeOqbThk7LxQlXTqt2nc7h0aeXFSc+uoWoJS4BseQTYnwT0+Cxu8bk4Db+juM 0ot3yE/qGbeWg== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id 923E29B; Tue, 15 Oct 2024 12:08:01 +0200 (CEST) Date: Tue, 15 Oct 2024 12:08:01 +0200 From: Alvaro Herrera To: Peter Eisentraut Cc: pgsql-hackers Subject: Re: simplify regular expression locale global variables Message-ID: <202410151008.jnqrposiz6p5@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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/