How useful is the money datatype?

From: Thom Brown <thombrown(at)gmail(dot)com>
To: PGSQL Mailing List <pgsql-general(at)postgresql(dot)org>
Subject: How useful is the money datatype?
Date: 2009-10-03 10:33:46
Message-ID: bddc86150910030333g38f196e0k70536c113fee1bee@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

I've noticed that while you can perform various calculations on a column of
type money, you can't use it or cast it as any other numeric type directly.
Furthermore, it appears that since the locale being applied to the type is
cluster-wide, you would need an entirely different cluster if say you had 2
web applications that were intended to store monetary amounts from different
locations.
Is there an advantage to a money data type over a NUMERIC(10,2) or just
representing it in lowest denomination of currency with an integer?

I've found that I unwittingly compiled PostgreSQL on my web server without
specifying locale, and now the money type is represented in dollars. In
order to change that, it would require a recompilation of PostgreSQL (and
I'm surprised that there is no option to set locale at the database-level in
the same way as collation has for 8.4).

Having a look around the archives, there seem to be some fairly old
discussions of possibly removing this data type, so is it fair to assume
it's probably not beneficial to use it?

Thanks

Thom

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter Geoghegan 2009-10-03 10:43:09 Re: How useful is the money datatype?
Previous Message Gerhard Wiesinger 2009-10-03 07:40:59 Re: PostgreSQL reads each 8k block - no larger blocks are used - even on sequential scans