Search Postgresql Archives

Re: Content for talk on Postgres Type System at PostgresConf

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 3/1/24 11:27, grimy.outshine830@xxxxxxxxxxx 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.klaver@xxxxxxxxxxx






[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux