Re: Content for talk on Postgres Type System at PostgresConf
От | Adrian Klaver |
---|---|
Тема | Re: Content for talk on Postgres Type System at PostgresConf |
Дата | |
Msg-id | 18088549-4d85-455b-822a-078aa3e2547b@aklaver.com обсуждение исходный текст |
Ответ на | Re: Content for talk on Postgres Type System at PostgresConf (grimy.outshine830@aceecat.org) |
Список | pgsql-general |
On 3/1/24 11:27, grimy.outshine830@aceecat.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.klaver@aklaver.com
В списке pgsql-general по дате отправления: