Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7hQj-00030Y-Vw for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Jun 2023 19:05:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q7hQi-0000YV-Qm for pgsql-bugs@arkaria.postgresql.org; Fri, 09 Jun 2023 19:05:48 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q7hQi-0000YM-5Y for pgsql-bugs@lists.postgresql.org; Fri, 09 Jun 2023 19:05:48 +0000 Received: from mail-yw1-x112f.google.com ([2607:f8b0:4864:20::112f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1q7hQd-001Ghe-Rc for pgsql-bugs@lists.postgresql.org; Fri, 09 Jun 2023 19:05:47 +0000 Received: by mail-yw1-x112f.google.com with SMTP id 00721157ae682-565ba6aee5fso19562537b3.1 for ; Fri, 09 Jun 2023 12:05:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joeconway.com; s=google; t=1686337542; x=1688929542; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=fuHPqXPVOkt0PZ2rqelJtFDHft5PwTM0kENSuvkbK4I=; b=IuTMXXrv4AQ0nkUfzW3BRF1PjgMBcabGkOWV/oNv7kemufCWJd4AhrJgoe2A/DS4sJ h0XSNdwPCf+hnhcwTP74lwXragEFztoJj5H5v0p+NXLRz6oVPAZMxKWZFDxWt5aJuW+R 94+t5ysfnFCrwPcRetEuUBTVkWnx4VNTCe/DqAwo/2hFfciVN0DbbcjZgvs1Zw2veZAY yhkLZ902YufeywouHnNZbOGDwqXxg7+1zE6IUN8sdLXwW7ndyHwQ1ebOlW0phA84GvHQ 88Ely0ZHrOtM5BFp+kZML7ZmADvl7bSrszCQ7+L4z2U+hoEbYKGr5NW8BxDFlwLyKIKl E46Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686337542; x=1688929542; h=content-transfer-encoding:in-reply-to:subject:from:references:cc:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=fuHPqXPVOkt0PZ2rqelJtFDHft5PwTM0kENSuvkbK4I=; b=CaMIjdSawvCuQHXySOo2kPDQlIaogTDmY8a2MPDg+DikdBrbBdet5q/zZficS3ewMa GoK5f2jYokLipQqL4yHgUac8DxpTOZxwVvRpcTB9DwYdIPDLuphU9XH9v6FcAG5RscWQ G/8lKtjbuK4/TjRwddJnfLM4+jl0F2EU5LXodtxyho7rpiZpxDHiNsdB6jFfgL0hgdXE DQD1qi5XaGL5tGchN1Wd3XT2PaY0x7goUFoCqXAEu3J3gFMQtqrodj2xmgINcyeuMVyx l+DcOVXxDApYGp6HqVhQMAnHdnnB8LQZQmQz+mjyJrWheIdM2xEoNAkujguw26dqJGKb JbNg== X-Gm-Message-State: AC+VfDySuOHNQCnAvBmiB5/+P1u/FmMEXo5CSPhJmjmRda3chjiFB6e5 jGEWrIzEN1RTgWiAhKwY3Wz3Rw== X-Google-Smtp-Source: ACHHUZ6zJl6OIesiB4Wuhukvuc8cS3eOgI6uSUClx4BIU5CeY2YZmD8mBer+zjAOzRJ30K/pKml77A== X-Received: by 2002:a0d:ce45:0:b0:565:b76d:3af7 with SMTP id q66-20020a0dce45000000b00565b76d3af7mr1947085ywd.3.1686337541988; Fri, 09 Jun 2023 12:05:41 -0700 (PDT) Received: from [192.168.4.41] (162-239-31-113.lightspeed.dybhfl.sbcglobal.net. [162.239.31.113]) by smtp.gmail.com with ESMTPSA id b63-20020a0dc042000000b0056ca07bbc03sm787369ywd.86.2023.06.09.12.05.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 09 Jun 2023 12:05:41 -0700 (PDT) Message-ID: Date: Fri, 9 Jun 2023 15:05:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Content-Language: en-US To: Tristan Partin , Heikki Linnakangas , Tom Lane , gdo@leader.it Cc: pgsql-bugs@lists.postgresql.org References: <17946-3e84cb577e9551c3@postgresql.org> <1564676.1685043220@sss.pgh.pa.us> <555bb26e-c27c-ab65-028f-3fd5b82df9de@iki.fi> From: Joe Conway Subject: Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/9/23 11:31, Tristan Partin wrote: > On Mon Jun 5, 2023 at 11:00 AM CDT, Heikki Linnakangas wrote: >> On 25/05/2023 15:33, Tom Lane wrote: >> > PG Bug reporting form writes: >> >> After upgrading an application using Postgresql from version 10 to 12, >> >> fields of type "money" are no longer generated with the € symbol but with >> >> $. >> > >> > Hmm, seems to work for me: >> >> I can reproduce this: >> >> psql (16beta1) >> Type "help" for help. >> >> postgres=# DO LANGUAGE 'plperl' $$ elog(NOTICE, 'foo') $$; >> NOTICE: foo >> DO >> postgres=# SET lc_monetary TO 'en_GB.UTF-8'; >> SET >> postgres=# SELECT 12.34::money AS price; >> price >> -------- >> $12.34 >> (1 row) >> >> >> If I don't call the plperl function, it works as expected: >> >> sql (16beta1) >> Type "help" for help. >> >> postgres=# SET lc_monetary TO 'en_GB.UTF-8'; >> SET >> postgres=# SELECT 12.34::money AS price; >> price >> -------- >> £12.34 >> (1 row) >> >> I should note that 'en_GB.UTF-8' is the default locale in my system, and >> that's what I used in initdb. I don't know if it makes a difference. > > I am looking into this bug. I have also reproduced it. It reproduces for me on both pg16beta1 and pg10. I wonder if it isn't a behavior change in libperl itself. It seems that merely doing "load 'plperl';" is enough to cause the issue as long as it is done prior to doing "SET lc_monetary TO 'en_GB.UTF-8'; SELECT 12.34::money AS price;". When done in the opposite order the problem does not occur. 8<------------------------------ # On pg10 with perl v5.34.0 # note that on my system # LC_NUMERIC="" # LC_ALL="" # LANG="en_US.UTF-8" # # this works correctly psql nmx << EOF SET lc_monetary TO 'en_GB.UTF-8'; SELECT 12.34::money AS price; load 'plperl'; SELECT 12.34::money AS price; EOF SET price -------- £12.34 (1 row) LOAD price -------- £12.34 (1 row) # this does not psql nmx << EOF SET lc_monetary TO 'en_GB.UTF-8'; load 'plperl'; SELECT 12.34::money AS price; EOF SET LOAD price -------- $12.34 (1 row) 8<------------------------------ Since I am also seeing this on pg10, I wonder if it is a change in perl.I found this[1]: "What did change is that perl space code no longer pays attention to the LC_NUMERIC category outside 'use locale'. This is the way it has always worked, AFAIK, for LC_COLLATE and, mostly, LC_CTYPE, and for some uses of LC_NUMERIC." [1] "locale changes in 5.19.1 break LC_NUMERIC handling" https://github.com/Perl/perl5/issues/13089 -- Joe Conway PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com