grimy.outshine830@aceecat.org writes:
> On Thu, Feb 29, 2024 at 05:51:11PM -0500, Tom Lane wrote:
>> Yeah. The fact that the same stored value might look like 10.00
>> euros to one session and 1000 yen to another one is pretty
>> catastrophic.
> But, doesn't what Tom says above contradict Adrian's example session?
No, what he showed was correct. I'm talking about a different
facet of the problem:
postgres=# show lc_monetary;
lc_monetary
-------------
en_US.utf8
(1 row)
postgres=# create table t (m money);
CREATE TABLE
postgres=# insert into t values('$1000.00');
INSERT 0 1
postgres=# table t;
m
-----------
$1,000.00
(1 row)
postgres=# set lc_monetary = 'ja_JP.utf8';
SET
postgres=# table t;
m
-----------
¥100,000
(1 row)
Even if that took account of the exchange rate, it'd not be great.
But it doesn't; it's just the same digits reinterpreted with a new
currency sign and possibly a different number of fractional digits.
This might be sort of tolerable if your database only ever deals in
one currency, but even then you'd likely want to lock down what
that currency is. Making it be controlled by a user-set GUC was
probably not a great idea.
regards, tom lane