Re: How useful is the money datatype?

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Guy Rouillier <guyr-ml1(at)burntmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How useful is the money datatype?
Date: 2009-10-05 19:55:10
Message-ID: 200910051955.n95JtA716207@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Guy Rouillier wrote:
> Christophe Pettus wrote:
> >
> > On Oct 4, 2009, at 7:09 PM, Guy Rouillier wrote:
> >> There is no reason why PG could not support packed decimal.
> >
> > Is that not NUMERIC?
>
> No, that is not NUMERIC. All numeric types are stored as binary
> representations. Packed decimal is not. Perhaps an example would
> clarify. The number 1234 would be represented as follows:

I think you are wrong. The Postgres documentation say:

The type <type>numeric</type> can store numbers with up to 1000
digits of precision and perform calculations exactly. It is
especially recommended for storing monetary amounts and other
quantities where exactness is required. However, arithmetic on
<type>numeric</type> values is very slow compared to the integer
types, or to the floating-point types described in the next
section.

Postgres NUMERIC is packed decimal, base 1000, as I remember.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Christophe Pettus 2009-10-05 20:07:16 Re: How useful is the money datatype?
Previous Message Guy Rouillier 2009-10-05 19:48:44 Re: How useful is the money datatype?