From: Tom Lane <tgl@sss.pgh.pa.us>
To: grimy.outshine830@aceecat.org
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Content for talk on Postgres Type System at PostgresConf
Date: Fri, 01 Mar 2024 15:25:35 -0500
Message-ID: <2985946.1709324735@sss.pgh.pa.us> (raw)
In-Reply-To: <fpec3abn57sz4pnjxgugbveksjrgiuh7g2wvov6kes5khgjo3i@4bs4jq7l3mv5>
References: <F9A4875C-503C-4D1F-8AA6-0C204F60D3F4@gmail.com>
<08e99a8fa744e063ea31030d6516bfc64c26e3f8.camel@cybertec.at>
<372fd5d1-8d7c-411e-8a35-41793978e74b@Spark>
<CAKFQuwbOXtDcYMM5SMbUNoxOSLCEjEgLG7qwnG2h15Vs51X69Q@mail.gmail.com>
<2758726.1709247071@sss.pgh.pa.us>
<fpec3abn57sz4pnjxgugbveksjrgiuh7g2wvov6kes5khgjo3i@4bs4jq7l3mv5>
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
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: tgl@sss.pgh.pa.us, grimy.outshine830@aceecat.org
Subject: Re: Content for talk on Postgres Type System at PostgresConf
In-Reply-To: <2985946.1709324735@sss.pgh.pa.us>
References: <F9A4875C-503C-4D1F-8AA6-0C204F60D3F4@gmail.com> <08e99a8fa744e063ea31030d6516bfc64c26e3f8.camel@cybertec.at> <372fd5d1-8d7c-411e-8a35-41793978e74b@Spark> <CAKFQuwbOXtDcYMM5SMbUNoxOSLCEjEgLG7qwnG2h15Vs51X69Q@mail.gmail.com> <2758726.1709247071@sss.pgh.pa.us> <fpec3abn57sz4pnjxgugbveksjrgiuh7g2wvov6kes5khgjo3i@4bs4jq7l3mv5> <2985946.1709324735@sss.pgh.pa.us>
* 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