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 1scW2u-0083Z2-Ue for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Aug 2024 20:17:09 +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 1scW2t-005nRE-2D for pgsql-hackers@arkaria.postgresql.org; Fri, 09 Aug 2024 20:17:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scW2r-005nR5-Tz for pgsql-hackers@lists.postgresql.org; Fri, 09 Aug 2024 20:17:06 +0000 Received: from fout2-smtp.messagingengine.com ([103.168.172.145]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1scW2o-0041Xl-AM for pgsql-hackers@postgresql.org; Fri, 09 Aug 2024 20:17:05 +0000 Received: from compute7.internal (compute7.nyi.internal [10.202.2.48]) by mailfout.nyi.internal (Postfix) with ESMTP id 2FF87138FC0A; Fri, 9 Aug 2024 16:17:00 -0400 (EDT) Received: from wimap25 ([10.202.2.85]) by compute7.internal (MEProxy); Fri, 09 Aug 2024 16:17:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=partin.io; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1723234620; x=1723321020; bh=aMy+UvwJg8q/O0xAXmy0gfQ4tMc9hButuoZcDsnEItc=; b= Wpfis5y7cofL/U8Fb1Ia9bGjoRk0gw4xlp1A0Y8I+30W/Tt5nt71h86zMhLvVYhs ZFEq9FpXsxYjVvKt61oXaj8sg6PLxlvkYANILt27PM5TrSBqpQ5Td4zGSzQFVfEF eM6lgw1p9qmyAwggHLmJfz99HKI8q4dC/Hg5qkKda6PFrLEaD3O688adFA8E1kJB hr0EV3gWwP623mRiyLS2RfokGFWQq7FIPaG8XVg0p6Cq0ULP2gmYlknRiUOLSuNf A2dp3eXmlbMUvAA+jrzjkfllIR3qF+1BrWPrO4A7UVbH5P9upLXMO+6+nxcKISIF QEgrBd0xahZyqop/gc6I/Q== 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 :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1723234620; x= 1723321020; bh=aMy+UvwJg8q/O0xAXmy0gfQ4tMc9hButuoZcDsnEItc=; b=c 3DxB1l9EoJM/zdDutFGXOXyeLWDVTMKb8UBLAK2QLD4Fhimhl1NOnWOlftA3SMU9 YAyR7cqwapTlFA0zSY58FWkmOU0AXE3+EmSgGB9a7yZbbkkCK1w4s7QKD47Kwcd7 X3eNxbSGS+oYa3LwQRahJX0yaTWUhwUERxjrGeLHOiP3sFX0Zq/8XRawNtptGfWh Te2S5+35Ua76VoD8EJPsKK4GHLzOFqLTUVHUuSnjJeEpqppCLkwmmPBvjlOxFHfm cT10TbFXeM0nm8ZDFb9+FeJBovohgbtNGZPmJ+EEGoihe5nzh939Jjo9jBL02Ibd AcnatzrflFHuxAc/Lfg2g== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddrleeggddugeehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpefoggfgtg ffkfevuffvhffofhgjsehtqhertdertdejnecuhfhrohhmpedfvfhrihhsthgrnhcurfgr rhhtihhnfdcuoehtrhhishhtrghnsehprghrthhinhdrihhoqeenucggtffrrghtthgvrh hnpeefgeefkeejledvvdehjeevjeeghefhgfdvieeljedvueekueevvdehgeeuffegvden ucffohhmrghinhepphhoshhtghhrrdgvshdpphhoshhtghhrvghsqhhlrdhorhhgpdhnvg honhdrthgvtghhnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhf rhhomhepthhrihhsthgrnhesphgrrhhtihhnrdhiohdpnhgspghrtghpthhtohepvddpmh houggvpehsmhhtphhouhhtpdhrtghpthhtohepphhgshhqlhesjhdquggrvhhishdrtgho mhdprhgtphhtthhopehpghhsqhhlqdhhrggtkhgvrhhssehpohhsthhgrhgvshhqlhdroh hrgh X-ME-Proxy: Feedback-ID: idd01497b:Fastmail Received: by mailuser.nyi.internal (Postfix, from userid 501) id A0B0A1040061; Fri, 9 Aug 2024 16:16:59 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8; format=Flowed Date: Fri, 09 Aug 2024 15:16:58 -0500 Message-Id: Cc: "pgsql-hackers" Subject: Re: Remaining dependency on setlocale() To: "Jeff Davis" From: "Tristan Partin" X-Mailer: aerc 0.18.2-22-gfff69046b02f References: <4c5da86af36a0d5e430eee3f60ce5e06f1b5cd34.camel@j-davis.com> In-Reply-To: <4c5da86af36a0d5e430eee3f60ce5e06f1b5cd34.camel@j-davis.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue Aug 6, 2024 at 5:00 PM CDT, Jeff Davis wrote: > After some previous work here: > > https://postgr.es/m/89475ee5487d795124f4e25118ea8f1853edb8cb.camel@j-davi= s.com > > we are less dependent on setlocale(), but it's still not completely > gone. > > setlocale() counts as thread-unsafe, so it would be nice to eliminate > it completely. > > The obvious answer is uselocale(), which sets the locale only for the > calling thread, and takes precedence over whatever is set with > setlocale(). > > But there are a couple problems: > > 1. I don't think it's supported on Windows. > > 2. I don't see a good way to canonicalize a locale name, like in > check_locale(), which uses the result of setlocale(). > > Thoughts? Hey Jeff, See this thread[0] for some work that I had previously done. Feel free=20 to take it over, or we could collaborate. [0]: https://www.postgresql.org/message-id/CWMW5OZBWJ10.1YFLQWSUE5RE9@neon.= tech -- Tristan Partin Neon (https://neon.tech)