Re: About the MONEY type

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: About the MONEY type
Дата
Msg-id CAHyXU0z3skWJ2tGsyeVUizYcCvra-Opx5m+ppDjajhLh3LWbPg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: About the MONEY type  (Raymond O'Donnell <rod@iol.ie>)
Ответы Re: About the MONEY type
Список pgsql-general
On Wed, Nov 30, 2016 at 7:43 AM, Raymond O'Donnell <rod@iol.ie> wrote:
> On 30/11/16 12:05, Thomas Kellerer wrote:
>>
>> Tobia Conforto schrieb am 30.11.2016 um 12:15:
>>>
>>> I think MONEY is a great datatype, at least in theory.
>>
>>
>> I personally find it pretty useless to be honest - especially because
>> the currency symbol depends on the client.
>>
>> So if I store a money value in the database, some clients see CHF,
>> some see Kč, some see £ and others might see € - all see the same
>> amount. Which seems totally wrong because 10€ is something completely
>> different then 10Kč or 10£.
>>
>> Plus: inside a programming language (e.g. Java/JDBC) it's hard to
>> work with the values because the database sends the values as a
>> string (it has to because of the currency symbol) but in reality it
>> is a number - but you can't just convert the String to a number again
>> because of the symbol.
>>
>> So I always recommend to not use it (in Postgres just as well as in
>> other DBMS, e.g. SQL Server)
>
>
> I seem to remember that it was actually deprecated at some point - this is
> going back quite a few years. This was later reversed, though I don't know
> why.

It was moved from a 32 bit implementation to a 64 bit one, and it was
given a lot of the previously missing basic infrastructure that was
needed to do normal simple things.  I would personally have preferred
to get rid it for the problems you mentioned.

With respect to FIXED, the NUMERIC datatype is already fixed precision
so the name is poor.  An all binary fixed precision datatype would be
a good idea for an extension, assuming one does not already exist (I
didn't check).

merlin


В списке pgsql-general по дате отправления:

Предыдущее
От: "David G. Johnston"
Дата:
Сообщение: Re: About the MONEY type
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Index is not used for "IN (non-correlated subquery)"