Re: How useful is the money datatype? - Mailing list pgsql-general

From Guy Rouillier
Subject Re: How useful is the money datatype?
Date
Msg-id 4AC9554B.8040909@burntmail.com
Whole thread Raw
In response to Re: How useful is the money datatype?  (Rich Shepard <rshepard@appl-ecosys.com>)
Responses Re: How useful is the money datatype?
List pgsql-general
Rich Shepard wrote:
> On Sun, 4 Oct 2009, Sam Mason wrote:
>
>>> Withing PG procedures at least in pgsql it is impossible to do 'money'
>>> calculations without a loss of precision.
>>
>> The point is that on *any* computer it's impossible to perform arbitrary
>> calculations to infinite precision (i.e. "without a loss of precision as
>> you put it).

>   Monetary values have always been an issue with computers. For a while, at
> least in the mainframe world of decades ago, binary-coded decimals (BCD)
> were a working approach.

Yes, packed decimal is a standard way to handle money with no loss of
precision.  And "for a while" would be over 50 years, as packed decimal
is still in use today.  All banks rely on it.  The best way to avoid
loss of precision with decimal is to use decimal representation, and not
convert to binary at all.  There is no reason why PG could not support
packed decimal.

--
Guy Rouillier

pgsql-general by date:

Previous
From: Scott Ribe
Date:
Subject: Re: ERROR: column "id" inherits conflicting default values
Next
From: Tom Lane
Date:
Subject: Re: ERROR: column "id" inherits conflicting default values