Re: About the MONEY type

Поиск
Список
Период
Сортировка
От rob stone
Тема Re: About the MONEY type
Дата
Msg-id 1480596314.5927.1.camel@gmail.com
обсуждение исходный текст
Ответ на Re: About the MONEY type  (John R Pierce <pierce@hogranch.com>)
Список pgsql-general
My two cents . . .
On Wed, 2016-11-30 at 13:35 -0800, John R Pierce wrote:
> On 11/30/2016 12:16 PM, John McKown wrote:
> > Speaking generically, I guess maybe MONEY needs to be somewhat
> > like a TIMESTAMP. At least in PostgreSQL, a TIMESTAMP can contain
> > a TIMEZONE. I guess a MONEY type should contain a modifier
> > identifying the issuer of the currency (E.g. U.S. Dollar vs
> > Canadian Dollar vs. Yen vs. Yuan vs. "precious metal").
> >
> >
>  
> and then it would need to be able to convert between all those
> units?        great fun.   it probably needs a time too, as those
> conversion units vary with time.   worse, they vary with where you
> convert the money and which way, and how much the converter
> skims....  In the real world,  US$ -> € -> US$  will not give you
> back the same amount.
>
>


I don't believe the OP is talking about currency conversions using
exchange rates.

It sounds like he would like a printf style string held in the same
column so that a select of that column would return a string formatted
by the printf style arguments, and presumably any arithmetic operations
would return the correct result. Complicated.

Currently, working in multi-currency environments you need to have
three columns -- one defined as NUMERIC(15,3) another to hold the ISO
currency code and the date. The date is necessary due to countries
shifting the decimal place leftwards due to inflation. E.g., inflation
in Venuzuela is around 1,500%pa at the moment. Ergo, the paper money
becomes worthless and if you are still using computers with 32 bit
integers you end up doing addition by hand.



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

Предыдущее
От: Francisco Olarte
Дата:
Сообщение: Re: btree gist indices, null and open-ended tsranges
Следующее
От: dharani kumar
Дата:
Сообщение: issue with host name lookup in PQconnectdb