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 1vG0ik-005jvP-3h for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Nov 2025 20:00:05 +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 1vG0ii-008ran-9N for pgsql-hackers@arkaria.postgresql.org; Mon, 03 Nov 2025 20:00:03 +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 1vG0ih-008rae-RH for pgsql-hackers@lists.postgresql.org; Mon, 03 Nov 2025 20:00:03 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vG0ie-005Grr-2n for pgsql-hackers@postgresql.org; Mon, 03 Nov 2025 20:00:01 +0000 Received: by mail-pj1-x1029.google.com with SMTP id 98e67ed59e1d1-33ba5d8f3bfso4174766a91.3 for ; Mon, 03 Nov 2025 12:00:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1762200000; x=1762804800; darn=postgresql.org; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:from:to:cc:subject :date:message-id:reply-to; bh=ZUbMb3YOa4Fy+JlYLDqj+7nIaUceML9SnD2sFCvXUk4=; b=bpGxZcpaBE+TiwYtjizqvNACWULFQp5hNrPLOOxtjqDeZpvejeJWNAwesp1MNHoyYK gRoOSBYmkfUnXthW0I6nu3bxZGwk4i5C3MK2vTh4RBCV33DDOgquMn+fGLbIeKk12gfp GqLmREig+cfUQwLRj6pRWq2gySS23O+/regKY1xS8ZItnMEREXjdFbxCPBeVv09d9fxz tFr/WNQhS2o1cMkDNH3xZmhsaxM9o1Wo/lOZ2EWuhXNIResoaibJD0CxwcYOaEmC7DgW fYCGfCECwgqCOhyYp5iJNf1L95QQsxPkO+id9k2uTfR0JbB4a9Hx+EPr24koSq9XwGb6 Zqmw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762200000; x=1762804800; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=ZUbMb3YOa4Fy+JlYLDqj+7nIaUceML9SnD2sFCvXUk4=; b=ChnW5ICu8CAnb75vvMIGV2WtmfiR3+lt8xp2JvLwnnNf5ilVP4+SF3uiF01Norerge jAm/g/EZXPmO7bLLtVuTYhqbU0ejIuiO12b5GTkn0YwiQzyp9kOfoGfc47rawimgIRDz drFlJwIC4MzuYMFtwryGNo3jqq31cfZDELkPkVooD0a5ryLngKDuQAUc6JriPWRuMz6s 1tbM/uxllUBrxrDT01IcWVx4kgqW0FMH+5x6J3Cxxar6xcTnDcFGM6Mng5A64kaiVBdb i9xZfmPBXNn7Yw2vcDTs9XECYlibVnEHqr2hhgV2y0jvlltyavrgDNdEwbwZofiC/qQ8 0xVg== X-Forwarded-Encrypted: i=1; AJvYcCVrmvbbyM16RGIREgWsn6ZlrdZRmh7MJ/aE7vQ0FmGin9WbK6RGaveOh+ObKyzmMGPf8Wv+fhjDM+8oULQc@postgresql.org X-Gm-Message-State: AOJu0Yyvs/R1kusuz/emATAZnw1Cv3dzpy0iOUAJub8OtLIluP7dY3H9 GI35geADYVtp3q+5hQKr5Pchcxyc8NSFydog2ES6Jc9m8V355quaiKwF0Gh767TdEA== X-Gm-Gg: ASbGnctKwxqIZqcoijVRksZG8sc3BBOg3NF9gtS36Mwx1v/eX/NgoSNUnsRdorfWalD 1Ip/YSAceubWIxEd4Wvh2pmN2FZ6LBVqQTX4H7Lka0FFvIHisvAdnJHfSdFK8xR0LPnV3ud5ar1 3nQxlkmA+DmNH3VjIRUf8udQkPeRrSOoeJQfeWAMJ1ywsaSyVv7YLncsZwUHGpmWBWEXK5PHMPS gi7LifL94X2i1R8N/6uc/MEMHhB0rECbwXWl7s4id0HY5XOvbXWJYAzFRegl7PdwfbLdMGTTtvz g0X+b9C6wOeLKG/aWmRNky5B0u1hCUVVs1v6VJ7tGuSjrytN7T6ndFxXiyr9siun0QjQyKFolts aB/G31zqq9fYdUtTzuBh4Ba8Z1NpOIpZeqBgmI9B9efTFduhmaJFuktAQ9mxhSwYkeWSJmtBr5h MJP80iKoamXH2pffxWR8v0A5uPDInG+jV3QiCSGc4M/jk= X-Google-Smtp-Source: AGHT+IHqsqKYCf1hVImzd3Z3XvH60HY7iC/YxDEfpQ634vFCTG0pTKEGEkz865e4hMrcSTgHPLySsw== X-Received: by 2002:a17:90b:134e:b0:33d:ad49:16da with SMTP id 98e67ed59e1d1-3408308cccdmr14713477a91.31.1762199999734; Mon, 03 Nov 2025 11:59:59 -0800 (PST) Received: from jeff-ws-bridge.lan (c-24-7-19-3.hsd1.ca.comcast.net. [24.7.19.3]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-3415c4aa8d3sm1909082a91.10.2025.11.03.11.59.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Nov 2025 11:59:59 -0800 (PST) Message-ID: <36dc305c6445970f7680dbba63cf9b32a5e91d27.camel@j-davis.com> Subject: Re: Remaining dependency on setlocale() From: Jeff Davis To: Daniel Verite Cc: Thomas Munro , Peter Eisentraut , Tom Lane , pgsql-hackers@postgresql.org Date: Mon, 03 Nov 2025 11:59:57 -0800 In-Reply-To: <5e709c7a-0504-426c-8a7d-e0701c334cd7@manitou-mail.org> References: <5e709c7a-0504-426c-8a7d-e0701c334cd7@manitou-mail.org> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, 2025-11-03 at 20:14 +0100, Daniel Verite wrote: > No, I think we should put the database's lc_ctype > into LC_CTYPE and the database's lc_collate into > LC_COLLATE, independently of anything else, > like it was done until commit 5e6e42e. > I believe that's the purpose of these database > properties, whether the provider is libc or ICU or builtin. Is there a clean way to document this behavior? I have tried to improve the documentation in this area before, but it's not easy because the behavior is so nuanced. The CREATE DATABASE command needs LOCALE (or LC_CTYPE/LC_COLLATE). But it's easy to get LOCALE and ICU_LOCALE or BUILTIN_LOCALE confused. And similarly for initdb. We could clean those up a lot if LC_CTYPE/LC_COLLATE didn't even need to be set for non-libc providers. Users can end up in a situation where they need to define LC_CTYPE/LC_COLLATE, even though it has almost (but not entirely) no effect: https://www.postgresql.org/message-id/f794e177b0b1ed8917e75258726ae315cf8fb= bef.camel%40j-davis.com Reverting commit 5e6e42e may be the right thing, but I'd like to hear what others have to say on this point first. In particualr, I'd like to know whether such a revert is based on principle, a practical problem, or just an abundance of caution. Another option we have here is LC_CTYPE=3DLC_COLLATE=3DC for non-libc providers, but leave it as in v17 for libc providers. If someone explicitly wants libc behavior (by specifying something like "use locale" in plperl), they probably want to be using the libc provider for the database. Regards, Jeff Davis