BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG - Mailing list pgsql-bugs

From PG Bug reporting form
Subject BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
Date
Msg-id 17946-3e84cb577e9551c3@postgresql.org
Whole thread Raw
Responses Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
List pgsql-bugs
The following bug has been logged on the website:

Bug reference:      17946
Logged by:          Guido Brugnara
Email address:      gdo@leader.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?


pgsql-bugs by date:

Previous
From: PG Bug reporting form
Date:
Subject: BUG #17945: Different order of definition of a constraint causes constraint violation
Next
From: Devrim Gündüz
Date:
Subject: Re: BUG #17943: Undefined symbol LLVMBuildGEP in llvmjit.so during pg_restore