pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Elphick <olly@lfix.co.uk>
To: Terry Hampton <thampton@limacorp.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: HELP !     With Money type
Date: Fri, 23 Jul 2004 14:20:43 +0100
Message-ID: <1090588843.1560.3.camel@braydb> (raw)
In-Reply-To: <41010659.90908@limacorp.com>
References: <41010659.90908@limacorp.com>

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)




view thread (3+ messages)  latest in thread

Message-ID: <1090588843.1560.3.camel@braydb>
Permalink:  ../1090588843.1560.3.camel@braydb/
Also on:    postgresql.org/message-id/1090588843.1560.3.camel@braydb

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: olly@lfix.co.uk, thampton@limacorp.com
  Subject: Re: HELP !     With Money type
  In-Reply-To: <1090588843.1560.3.camel@braydb>
  References: <41010659.90908@limacorp.com> <1090588843.1560.3.camel@braydb>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox