From: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
---|---|
To: | pgsql-general(at)lists(dot)postgresql(dot)org |
Subject: | Re: Content for talk on Postgres Type System at PostgresConf |
Date: | 2024-03-01 20:15:41 |
Message-ID: | 18088549-4d85-455b-822a-078aa3e2547b@aklaver.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
On 3/1/24 11:27, grimy(dot)outshine830(at)aceecat(dot)org wrote:
> On Thu, Feb 29, 2024 at 05:51:11PM -0500, Tom Lane wrote:
>
>>>> money is a fixed-point decimal value, the number of decimal
>>>> places is locale determined. I’m not aware of any particular
>>>> problems with that
>
>>> You forget about the currency symbol dynamic. Like with time zones
>>> the local session provides the context, not the stored data.
>
>> 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. The other nasty thing about money is that it's an
>> int64 so it can't represent more than 2^63 pennies (for whatever a
>> "penny" is). Now, that's still a Frickin Lot Of Money in any
>> non-hyperinflated currency, but it's the sort of restriction that
>> banks don't like to hear of.
>
> Lame excuse first: I have never used the money type, probably because
> I overheard a word like "catastrophic" in my early development :-)
>
> But, doesn't what Tom says above contradict Adrian's example session?
> Either the stored value is re-interpreted according to the locale
> context, or it isn't. IMO it would be *more* catastrophic if it wasn't,
> as it looks from Adrian's example.
>
test=# set lc_monetary='de_DE.utf8';
SET
test=# select 10::money;
money
---------
10,00 €
(1 row)
test=# set lc_monetary='ja_JP.utf8';
SET
test=# select 10::money;
money
-------
¥10
(1 row)
--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2024-03-01 20:25:35 | Re: Content for talk on Postgres Type System at PostgresConf |
Previous Message | grimy.outshine830 | 2024-03-01 19:27:29 | Re: Content for talk on Postgres Type System at PostgresConf |