From: Joe Conway <mail@joeconway.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Tristan Partin <tristan@neon.tech>
Cc: Heikki Linnakangas <hlinnaka@iki.fi>
Cc: gdo@leader.it
Cc: pgsql-bugs@lists.postgresql.org
Subject: Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
Date: Sat, 10 Jun 2023 15:28:47 -0400
Message-ID: <574a1afa-5c6e-829c-0fed-a9ff44719f9f@joeconway.com> (raw)
In-Reply-To: <c23d6ec1-f882-af48-82d9-54e9f3e15809@joeconway.com>
References: <17946-3e84cb577e9551c3@postgresql.org>
<1564676.1685043220@sss.pgh.pa.us>
<555bb26e-c27c-ab65-028f-3fd5b82df9de@iki.fi>
<CT887GSPI31W.BQCSW35JL67L@gonk>
<ca35e375-be82-322d-8c81-78127d8fb33f@joeconway.com>
<5676b739-0854-f924-4b97-466e3504c692@joeconway.com>
<f1856a5d-3703-66ff-e7c7-01d2489315c1@joeconway.com>
<665279.1686422574@sss.pgh.pa.us>
<c23d6ec1-f882-af48-82d9-54e9f3e15809@joeconway.com>
On 6/10/23 15:07, Joe Conway wrote:
> On 6/10/23 14:42, Tom Lane wrote:
>> Joe Conway <mail@joeconway.com> writes:
>>> 5/ The attached fixes the issue for me on pg10 and passes check-world.
>>> Comments?
>>
>> The call in PGLC_localeconv seems *very* oddly placed. Why not
>> do that before it does any other locale calls? Otherwise you don't
>> really have reason to believe you're saving the appropriate
>> values to restore later.
>
>
> As far as I can tell it really only affects localeconv(), so I tried to
> place it close to those. But I am fine with moving it up.
This version is against pg16 (rather than pg10), moves up that hunk,
mentions localeconv() in the comment as the reason for the call, and
fixes some whitespace sloppiness. I will plan to apply to all supported
branches.
Better?
--
Joe Conway
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.comAttachments:20230610-plperl_locale_issue-001.patch (text/x-patch, 1.3K) downloaddiff --git a/src/backend/utils/adt/pg_locale.c b/src/backend/utils/adt/pg_locale.cindex 31e3b16..0cd3237 100644
*** a/src/backend/utils/adt/pg_locale.c
--- b/src/backend/utils/adt/pg_locale.c
*************** PGLC_localeconv(void)
*** 505,510 ****
--- 505,517 ----
}
/*
+ * Ensure the global locale is being used by localeconv().+ * This is necessary, for example, if another loaded library+ * such as libperl has done uselocale() underneath us.+ */+ uselocale(LC_GLOBAL_LOCALE);+ + /*
* This is tricky because we really don't want to risk throwing error
* while the locale is set to other than our usual settings. Therefore,
* the process is: collect the usual settings, set locale to special
diff --git a/src/fe_utils/print.c b/src/fe_utils/print.cindex 7af1ccb..4ef4d9e 100644
*** a/src/fe_utils/print.c
--- b/src/fe_utils/print.c
*************** setDecimalLocale(void)
*** 3628,3633 ****
--- 3628,3639 ----
{
struct lconv *extlconv;
+ /*+ * Ensure the global locale is being used by localeconv().+ * This is necessary, for example, if another loaded library+ * has done uselocale() underneath us.+ */+ uselocale(LC_GLOBAL_LOCALE);
extlconv = localeconv();
/* Don't accept an empty decimal_point string */
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: mail@joeconway.com, tgl@sss.pgh.pa.us, tristan@neon.tech, hlinnaka@iki.fi, gdo@leader.it
Subject: Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
In-Reply-To: <574a1afa-5c6e-829c-0fed-a9ff44719f9f@joeconway.com>
References: <17946-3e84cb577e9551c3@postgresql.org> <1564676.1685043220@sss.pgh.pa.us> <555bb26e-c27c-ab65-028f-3fd5b82df9de@iki.fi> <CT887GSPI31W.BQCSW35JL67L@gonk> <ca35e375-be82-322d-8c81-78127d8fb33f@joeconway.com> <5676b739-0854-f924-4b97-466e3504c692@joeconway.com> <f1856a5d-3703-66ff-e7c7-01d2489315c1@joeconway.com> <665279.1686422574@sss.pgh.pa.us> <c23d6ec1-f882-af48-82d9-54e9f3e15809@joeconway.com> <574a1afa-5c6e-829c-0fed-a9ff44719f9f@joeconway.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox