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

Re: Python interface and Money?

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: <thomas(at)pgsql(dot)com>
Cc: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>, Joel Mc Graw <jmcgraw(at)databill(dot)com>, <pgsql-interfaces(at)postgresql(dot)org>
Subject: Re: Python interface and Money?
Date: 2001-10-25 18:32:30
Message-ID: Pine.LNX.4.30.0110250005550.647-100000@peter.localdomain (view raw or flat)
Lists: pgsql-interfaces
Thomas Lockhart writes:

> ...
> > > While browsing the mailing list for an answer to this problem I found
> > > several references to the money type being deprecated.  Is that the
> > > problem?
> > They keep saying that DECIMAL should be used instead but they are not
> > exactly equivalent.  The MONEY type was originally written with locale
> > support and displays the local currency symbol.
> Hmm. If we keep the money type then we should change the internal
> implementation to use numeric or decimal or at least int64 instead of
> int32. Comments?

The purpose of a data type is to store data and attach a semantic value to
it, not to be a tool for presentation.  The money type doesn't even do the
former correctly because when you change the locale, the amount stored
changes.  Since we have a very fine to_char() function, there is no longer
a need for a separate money type, unless you want to have a type that
stores a number plus a currency unit.

Another reason why I personally consider the money type not very useful is
that the very display format it touts makes it a PITA to parse the output
in client applications.

If you want to have a really silly analogy for why the money type is
wrong, imagine a "length" type, that stores a number, and depending on the
current locale, it prints meters or yards.  (Note, it doesn't do the
conversion, it just prints '#### meters' or '#### yards', where #### =
####.)  I presume that most people would consider a length type nonsense
in the first place, but that added feature makes it useless.

Peter Eisentraut   peter_e(at)gmx(dot)net

In response to

pgsql-interfaces by date

Next:From: Paul TevisDate: 2001-10-25 23:58:49
Subject: PyGreSQL and Unlinking Large Objects
Previous:From: D'Arcy J.M. CainDate: 2001-10-25 11:56:50
Subject: Re: Python interface and Money?

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