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.96) (envelope-from ) id 1vVEKe-00GnkC-0u for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 19:34:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vVEKd-0024QU-0k for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 19:34:08 +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.96) (envelope-from ) id 1vVEKc-0024QJ-2k for pgsql-hackers@lists.postgresql.org; Mon, 15 Dec 2025 19:34:07 +0000 Received: from mail-pj1-x1030.google.com ([2607:f8b0:4864:20::1030]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vVEKa-000uk1-2d for pgsql-hackers@postgresql.org; Mon, 15 Dec 2025 19:34:07 +0000 Received: by mail-pj1-x1030.google.com with SMTP id 98e67ed59e1d1-34c84dc332cso1684886a91.0 for ; Mon, 15 Dec 2025 11:34:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=j-davis-com.20230601.gappssmtp.com; s=20230601; t=1765827243; x=1766432043; 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=V8R+0STxZL7SyRGk1RczId5V44DT7Rw+TQzJUxEyyGs=; b=Q1+NZgsWQlQWAa+/aMVpA43CEg4kDxtnBV0Z8dYH2XcEWNwVvN8nPn7Wf1vTgtpjpl wO+WQJA6gd8rtgpLu/z8Uml1QQDBRxEupSwXvneEVAFs8cVI8QvjciWjDTq4ouvwF43p VQJl3HhjxTJu3iIRKUUyclZx0DLRNaqgp7smhQC4SvS/1NjENJIxtCMtDWlTYWXcCs2F 6IuJHpN6oa9UZ9rokWvSsGoAaZoQouUi/iyz8C/UZouyu/zv5uHaKrq+oLBShLuONJCw QRkjN599b3VbypXdYp/qrQLRuyIgKbNolg49Sb4lvSnAEKuZ/mC5DodXiw7CxwYrh3on KfGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765827243; x=1766432043; h=mime-version:user-agent:content-transfer-encoding:references :in-reply-to:date:cc:to:from:subject:message-id:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=V8R+0STxZL7SyRGk1RczId5V44DT7Rw+TQzJUxEyyGs=; b=iv9AR4fXFMRHRy9HtPHWII4biFkee858tfHjhOcjVlNmp2Xea7DEYImtvY3J+CUXgp DCb9rjRp66ADNETq67N/P1L7ms97Qo28QGCJpwLRdD1WGxfYRQ+SCHK6YaaLNRRBTLaU mNpR/OHpTiRJpX3lOBP4qyPg9hy4xqL9zE61NGVFUx1NuTOxHLpeSBt43i2Dl7q+22nB fMUXjCvkz0g6l00EhpJ/4pR90WWSHm12AznGILtMVNZeC/vl/Wx3UnLphrqZcwMGVpa5 m1KEHXsEPrxPAluCANAKckTxABt+zDR9qADS/n1THAKHC+9IeB6NwE23BHrLEuhkt4de nu8Q== X-Forwarded-Encrypted: i=1; AJvYcCUykQKOE6uqZA25WTlfA/OhaqAbK7wI94c+/Rz2dMqNBCWDcGApUpG5suOSTLlUaEO3Py2ODsV2IZMcKKYt@postgresql.org X-Gm-Message-State: AOJu0YyTQTIezpYGBBRMXL7iC0XJPE8FkqfF33oixKu/5eUgMAJyuAib xeIaJbkLRbsXBIfpD5bobZvkWrvCwWPmA47bXHVX0Q5WsmgktA6Yz2kUVwCVO9uRlg== X-Gm-Gg: AY/fxX4X3NzSa9v8XbTuDGzjw4DNtCt3gVB8zGZSmvYC5b3Bq6yrBBLbUSmMqMQ5f4h kykSPHkHZj1wPr2Be796ddXgfSwDpwPyDN8znahF2O4XzIAZFsbGtOiwTLdF+dcW5aYmmTZlfU7 THZEDv2oyV1dpm/fQ+avSAwLv92VCZCvEOYelGNxb7wAguBQCFKXvEwwTi7SQD3fbrkKEv5kDfx 55NfwVjgWmLQRdRq4rS9qsBhw1wNYiYpbVQiWJHLGicTk0Hx3MFzKUmjwhfLvNVw6yUVLio06lM v78roDjTB0+SW56OpHBd+ijic1mu9oRmkDD+wgX1ZT9qBT71XdGZA89CI7fq1BC287jvIY2gfZq CAg4QRBVUxtsJtn2zkmf+WzQW6cA03M+1YZ2sUjtwv3bQs8CEruKz2kkOVzNXKppc/nkYnPdpLO XvPjjoAMll+r6ZmDDdVE0drmF9QlMd6Pl+i+gopQ4vO5c= X-Google-Smtp-Source: AGHT+IH4p0nOlJrbhOTbh4m/ztjB2ov+r5wLqyS1ahBYh+1vS1xcdtUbpbIZS2OcElt0c5iDoY3lRg== X-Received: by 2002:a17:90b:3f85:b0:341:a9e7:e5f9 with SMTP id 98e67ed59e1d1-34abd5dc26emr11095835a91.0.1765827243045; Mon, 15 Dec 2025 11:34:03 -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-34abe2aa5c8sm9898364a91.15.2025.12.15.11.34.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Dec 2025 11:34:02 -0800 (PST) Message-ID: <5f70ee8a3f73df753285f8928c01dd32f14d7fcb.camel@j-davis.com> Subject: Re: Remaining dependency on setlocale() From: Jeff Davis To: Chao Li Cc: Peter Eisentraut , Thomas Munro , Tom Lane , pgsql-hackers@postgresql.org Date: Mon, 15 Dec 2025 11:34:01 -0800 In-Reply-To: <0E8DD47F-710D-45E1-B87F-2336042A377E@gmail.com> References: <4c5da86af36a0d5e430eee3f60ce5e06f1b5cd34.camel@j-davis.com> <6956823dd669abc64183fc91e64dc2e56e31f3ea.camel@j-davis.com> <8186b28a1a39e61a0d833a4c25a8909ebbbabd48.camel@j-davis.com> <450ceb6260cad30d7afdf155d991a9caafee7c0d.camel@j-davis.com> <78edc741a168c54d57cc898a5877b6443527a2c8.camel@j-davis.com> <83F6E6A9-FF29-41C9-9E15-EA5360E912D0@gmail.com> <5f65b85740197ba6249ea507cddf609f84a6188b.camel@j-davis.com> <38f3f4a6-e95e-47a7-914f-110dd6191301@eisentraut.org> <0e186a9a92634f0c5675a618ff5685d00cd8f836.camel@j-davis.com> <0E8DD47F-710D-45E1-B87F-2336042A377E@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.52.3-0ubuntu1.1 MIME-Version: 1.0 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 2025-12-13 at 17:48 +0800, Chao Li wrote: > 1 - 0001 > ``` > + int match_mblen pg_attribute_unused(); > ``` >=20 > Why this variable is marked unused? It=E2=80=99s actually used. Fixed and committed. I originally marked it unused because I just had an: Assert(match[match_mblen] =3D=3D '\0'); but I changed it to just set it: match[match_mblen] =3D '\0'; for clarity, even though I think the underlying API guarantees NUL- termination. > 2 - 0002 >=20 > I did a search and found one place that you missed at line 181 in > pg_locale.h > ``` > extern bool char_is_cased(char ch, pg_locale_t locale); > ``` Thank you, fixed and committed. I'll continue committing v12 0003-0005. Note that I'm planning to backport 0003. I'm also inclined to move forward with 0006. It's not a long-term solution, but it solves an instance of the problem under discussion in this thread (removes setlocale() dependency) and is a narrow fix. After that, remaining loose ends: * 0007: Can we just rip out the non-ASCII support? If it's gone all this time without UTF8 support, and there's no suggestion about what the non-ASCII behavior should be (in docs or source code), then it's probably not terribly important. * Use of pg_strncasecmp() in the backend, which uses tolower() to do case-insensitive matching of command options, e.g. "if (pg_strcasecmp(a, "plain") =3D=3D 0)" to check for PLAIN storage in CREATE TYPE. *=C2=A0strerror(): either consider an lc_ctype GUC, or the approach over here[1]. * Daniel suggests that we need some way to set LC_COLLATE for extensions/dependencies. * address calls to pg_tolower in datetime.c and tzparser.c -- can those just be pg_ascii_tolower()? * examine remaining isalpha(), etc., calls in the backend Regards, Jeff Davis [1] https://www.postgresql.org/message-id/flat/90f176c5b85b9da26a3265b2630ece35= 52068566.camel@j-davis.com