BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG

From: PG Bug reporting form <noreply(at)postgresql(dot)org>
To: pgsql-bugs(at)lists(dot)postgresql(dot)org
Cc: gdo(at)leader(dot)it
Subject: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
Date: 2023-05-25 15:21:26
Message-ID: 17946-3e84cb577e9551c3@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 17946
Logged by: Guido Brugnara
Email address: gdo(at)leader(dot)it
PostgreSQL version: 12.15
Operating system: Ubuntu 20.04
Description:

After upgrading an application using Postgresql from version 10 to 12,
fields of type "money" are no longer generated with the € symbol but with
$.
I identified the problem that occurs when making use of functions with
"LANGUAGE plperl," see with the following queries to be executed in order:
# from shell ...
sudo su -c psql\ postgres postgres <<'__SQL__';
SET lc_monetary TO 'C';
SELECT 12.34::money AS price;
SET lc_monetary TO 'it_IT.UTF-8';
SELECT 12.34::money AS price;
SET lc_monetary TO 'en_GB.UTF-8';
SELECT 12.34::money AS price;
CREATE EXTENSION plperl;
SET lc_monetary TO 'C';
SELECT 12.34::money AS price;
DO LANGUAGE 'plperl' $$ my $rv = spi_exec_query(q{SELECT 12.34::money AS
price;}, 1);elog(NOTICE, $rv->{rows}[0]->{price});$$;
SET lc_monetary TO 'it_IT.UTF-8';
SELECT 12.34::money AS price;
DO LANGUAGE 'plperl' $$ my $rv = spi_exec_query(q{SELECT 12.34::money AS
price;}, 1);elog(NOTICE, $rv->{rows}[0]->{price});$$;
SET lc_monetary TO 'en_GB.UTF-8';
SELECT 12.34::money AS price;
DO LANGUAGE 'plperl' $$ my $rv = spi_exec_query(q{SELECT 12.34::money AS
price;}, 1);elog(NOTICE, $rv->{rows}[0]->{price});$$;
__SQL__
#end.

The first three SELECTs generate content with the currencies Dollar, Euro &
Pound, as expected, while the last three only with Dollar.
It would appear that after first DO LANGUAGE 'plper' call, LC_MONETARY even
if it is varied, has no effect in subsequent queries.
Any suggestions?

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Devrim Gündüz 2023-05-25 17:21:30 Re: BUG #17943: Undefined symbol LLVMBuildGEP in llvmjit.so during pg_restore
Previous Message PG Bug reporting form 2023-05-25 14:39:13 BUG #17945: Different order of definition of a constraint causes constraint violation

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2023-05-25 16:24:27 Re: Order changes in PG16 since ICU introduction
Previous Message torikoshia 2023-05-25 14:51:18 Re: Allow pg_archivecleanup to remove backup history files