Re: Content for talk on Postgres Type System at PostgresConf

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: grimy(dot)outshine830(at)aceecat(dot)org
Cc: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Content for talk on Postgres Type System at PostgresConf
Date: 2024-03-01 20:25:35
Message-ID: 2985946.1709324735@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

grimy(dot)outshine830(at)aceecat(dot)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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message normandavis1990 2024-03-01 20:29:17 How to clone a database?
Previous Message Adrian Klaver 2024-03-01 20:15:41 Re: Content for talk on Postgres Type System at PostgresConf