pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: gdo@leader.it
Subject: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
Date: Thu, 25 May 2023 15:21:26 +0000
Message-ID: <17946-3e84cb577e9551c3@postgresql.org> (raw)

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?



view thread (38+ messages)  latest in thread

Message-ID: <17946-3e84cb577e9551c3@postgresql.org>
Permalink:  ../17946-3e84cb577e9551c3@postgresql.org/
Also on:    postgresql.org/message-id/17946-3e84cb577e9551c3@postgresql.org

 · 

reply

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 using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, gdo@leader.it
  Subject: Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
  In-Reply-To: <17946-3e84cb577e9551c3@postgresql.org>

* 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