Re: Money locale currency symbol position

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Marko Mikulicic <marko(at)seul(dot)org>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Money locale currency symbol position
Date: 2002-07-30 04:35:31
Message-ID: 29049.1028003731@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Marko Mikulicic <marko(at)seul(dot)org> writes:
> Tom Lane wrote:
>> Note though that most of us think the current money type is a kluge
>> anyway; anything based on int4 storage doesn't have enough significant
>> digits. It would be better rewritten as a thin locale-aware veneer
>> over type "numeric".

> I agree.
> Is there an example of how to inherit from a parametrized type ?

I think you could mostly do this with binary compatibility: if money
were binary-equivalenced to numeric then most of the right things
would happen. (Compare type regproc to type oid --- regproc has
no behavior other than special I/O functions, and still manages to
inherit most of oid's other behaviors.)

One thing you would not get out of that is the ability to say
"money(m,n)" to specify precision --- that would take specialized
hacking in the parser. But I'm not sure you want it. The preferred
number of fractional digits should be determined from the monetary
locale, *not* from any SQL declaration. And there's no good reason to
limit the total number of digits at all.

> Is possible to view the CREATE TYPE command which creates the
> internal type numeric?

There is no such command, because internal types are "created" by
direct insertions of rows into pg_type during initdb. Look at
the contents of src/include/catalog/pg_type.h.

> If you want to use numeric I guess you cannot use strfmon because it uses
> float or double and it's not arbitrary precision.

Ugh. Time to start writing code :-(

regards, tom lane

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message pgsql-bugs 2002-07-30 14:04:11 Bug #723: XlogFlush
Previous Message Bruce Momjian 2002-07-30 02:52:57 Re: Select For Update bug???