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 1sbSaK-00GinI-Td for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Aug 2024 22:23:16 +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 1sbSaI-003Gtw-AZ for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Aug 2024 22:23:14 +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 1sbSaI-003Gto-0K for pgsql-hackers@lists.postgresql.org; Tue, 06 Aug 2024 22:23:14 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sbSaF-003Wzh-4g for pgsql-hackers@postgresql.org; Tue, 06 Aug 2024 22:23:13 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 476MN9co1841103; Tue, 6 Aug 2024 18:23:09 -0400 From: Tom Lane To: Jeff Davis cc: pgsql-hackers@postgresql.org Subject: Re: Remaining dependency on setlocale() In-reply-to: <4c5da86af36a0d5e430eee3f60ce5e06f1b5cd34.camel@j-davis.com> References: <4c5da86af36a0d5e430eee3f60ce5e06f1b5cd34.camel@j-davis.com> Comments: In-reply-to Jeff Davis message dated "Tue, 06 Aug 2024 14:59:55 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1841101.1722982989.1@sss.pgh.pa.us> Date: Tue, 06 Aug 2024 18:23:09 -0400 Message-ID: <1841102.1722982989@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Jeff Davis writes: > But there are a couple problems: > 1. I don't think it's supported on Windows. Can't help with that, but surely Windows has some thread-safe way. > 2. I don't see a good way to canonicalize a locale name, like in > check_locale(), which uses the result of setlocale(). What I can tell you about that is that check_locale's expectation that setlocale does any useful canonicalization is mostly wishful thinking [1]. On a lot of platforms you just get the input string back again. If that's the only thing keeping us on setlocale, I think we could drop it. (Perhaps we should do some canonicalization of our own instead?) regards, tom lane [1] https://www.postgresql.org/message-id/14856.1348497531@sss.pgh.pa.us