pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Gamache <cgg007@yahoo.com>
To: Harald Fuchs <hf118@protecting.net>
To: pgsql-admin@postgresql.org
Subject: Re: Alternative to "Money" ...
Date: Tue, 3 Feb 2004 06:17:33 -0800 (PST)
Message-ID: <20040203141733.80158.qmail@web13805.mail.yahoo.com> (raw)
In-Reply-To: <puk735bf2w.fsf@srv.protecting.net>


... I can't _quite_ tell if you're serious or not ... :)

If you are serious, are you saying to do something like:

CREATE TABLE new_money (product text, dollars int4, cents int4);
INSERT INTO new_money (product, dollars, cents) values ('Flowbee','19','95');
INSERT INTO new_money (product, dollars, cents) values ('Garth Brooks\'s
Greatest Hits','9','99');

SELECT product, (dollars || '.' || cents)::numeric FROM new_money;
           product            | numeric
------------------------------+---------
 Flowbee                      |   19.95
 Garth Brooks's Greatest Hits |    9.99
(2 rows)

... Will that really improve performance? I'd probably have to create a view
and rule on the view if I didn't want to drasticly alter the way I'm handling
currency in my pre-existing code ...

CG

--- Harald Fuchs <hf118@protecting.net> wrote:
> In article <20040130203122.GA1488@wolff.to>,
> Bruno Wolff III <bruno@wolff.to> writes:
> 
> > On Fri, Jan 30, 2004 at 10:55:13 -0800,
> >   Chris Gamache <cgg007@yahoo.com> wrote:
> >> Well, after living with the (depreciated) Money datatype for 5 years, I
> think
> >> its finally time to say goodbye (and now that we have DROP COLUMN it'll be
> MUCH
> >> easier transition). What's the preferred monetary datatype? numeric(10,2)?
> >> float4? float8? We're dealing only with US Dollars.
> 
> > You probably just want plain numeric.
> 
> As long as you don't want to deal with the new US budget deficit,
> storing cents in an INT or BIGINT column might perform better.
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings


__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/



view thread (10+ messages)  latest in thread

Message-ID: <20040203141733.80158.qmail@web13805.mail.yahoo.com>
Permalink:  ../20040203141733.80158.qmail@web13805.mail.yahoo.com/
Also on:    postgresql.org/message-id/20040203141733.80158.qmail@web13805.mail.yahoo.com

 · 

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: cgg007@yahoo.com, hf118@protecting.net
  Subject: Re: Alternative to "Money" ...
  In-Reply-To: <20040203141733.80158.qmail@web13805.mail.yahoo.com>
  References: <puk735bf2w.fsf@srv.protecting.net> <20040203141733.80158.qmail@web13805.mail.yahoo.com>

* 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