Re: Money locale currency symbol position

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: Money locale currency symbol position
Дата
Msg-id 29049.1028003731@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Money locale currency symbol position  (Marko Mikulicic <marko@seul.org>)
Список pgsql-bugs
Marko Mikulicic <marko@seul.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

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: Select For Update bug???
Следующее
От: pgsql-bugs@postgresql.org
Дата:
Сообщение: Bug #723: XlogFlush