Re: Money type

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "D'Arcy J(dot)M(dot) Cain" <darcy(at)druid(dot)net>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Money type
Date: 2002-05-16 14:07:48
Message-ID: 3068.1021558068@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

"D'Arcy J.M. Cain" <darcy(at)druid(dot)net> writes:
> Also somewhat NA centric is the two decimal places. This was originally
> meant to be locale driven but that is a problem for other reasons. What
> about defaulting it to two decimal places but allowing it to be redefined at
> table creation time? How hard would it be to make it accept an optional
> precision?

Possible, but in 32 bits you don't really have room to offer more
precision. Another objection is that (AFAIK) there's no way to handle
precision specs without wiring them into quite a number of places in the
parser, format_type, etc. I'd object to doing that for a nonstandard
type like money.

> Limited precision. This can be fixed by going to a 64 bit integer for the
> underlying type. Are we at a point where we can do that yet? I am afraid
> that there are still systems that don't have a native 64 bit type.

You could possibly use the same sort of hacks as are in the int8 support
--- type int8 is still functional on int64-less platforms, it just has
the same range as int4. I guess this would be no loss of functionality
compared to where money is now.

> As the original author of the type I naturally have some bias but I still
> think that it is a good type for all the reasons we thought it was a good
> idea before. There is a definite advantage to being able to do integer
> arithmetic right on the CPU in large financial applications.

I'd rather see the effort invested in making type 'numeric' faster.
Even with a 64-bit width, money would still be subject to silent
overflow, which I find uncool for financial applications...

regards, tom lane

In response to

  • Money type at 2002-05-16 10:11:43 from D'Arcy J.M. Cain

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-05-16 14:57:14 Re: WIN32 native ... lets start?!?
Previous Message Marc G. Fournier 2002-05-16 13:38:25 Re: WIN32 native ... lets start?!?