Skip site navigation (1) Skip section navigation (2)

Re: HELP ! With Money type

From: Oliver Elphick <olly(at)lfix(dot)co(dot)uk>
To: Terry Hampton <thampton(at)limacorp(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: HELP ! With Money type
Date: 2004-07-23 13:20:43
Message-ID: 1090588843.1560.3.camel@braydb (view raw or flat)
Thread:
Lists: pgsql-admin
On Fri, 2004-07-23 at 13:36, Terry Hampton wrote:
> 
> 	Everyone,
> 
> 	Just ran across an odd situation.
> 	I have defined a field:
> 
>   amount       | money                    | not null default ''
> 
> 	Works fine until the dollar amounts get
> 	very large  -  into the tens of millions.
> 	At that point, the actual amount stored
> 	becomes very unpredictable.
> 
> 	I just saved a record via a simple
> 	front end App.  I entered 56,000,000
> 	When I retrieved the record i got:
> 		$13,050,327.04  !!
> 
> 	Any thoughts ?

The Money type is deprecated.  It uses a floating point representation,
which is not good for precise values.

Use DECIMAL instead - e.g. DECIMAL(12,2)


In response to

Responses

pgsql-admin by date

Next:From: Negyesi KarolyDate: 2004-07-23 14:07:51
Subject: replication and linux-ha?
Previous:From: Terry HamptonDate: 2004-07-23 13:09:03
Subject: [Fwd: Re: HELP ! With Money type]

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group