Обсуждение: Re: [HACKERS] Money type display

Поиск
Список
Период
Сортировка

Re: [HACKERS] Money type display

От
Andrew Martin
Дата:
> I wonder if I didn't make a mistake in the money type.  As a C library
> function it made sense to add the "$" to the display because it was
> easy to add one to the return value if it wasn't required.  I'm finding
> it to be a bit of a problem with my Python interface.  I was just
> going to strip it in my module but I thought I would see if others
> felt that it should simply be dropped from the PostgreSQL output.
>
Remove it! Those of us who aren't American/Canadian/Australian don't want
a dollar sign for money anyway :-)


Andrew

----------------------------------------------------------------------------
Dr. Andrew C.R. Martin                             University College London
EMAIL: (Work) martin@biochem.ucl.ac.uk    (Home) andrew@stagleys.demon.co.uk
URL:   http://www.biochem.ucl.ac.uk/~martin
Tel:   (Work) +44(0)171 419 3890                    (Home) +44(0)1372 275775

Re: [HACKERS] Money type display

От
darcy@druid.net (D'Arcy J.M. Cain)
Дата:
Thus spake Andrew Martin
> > I wonder if I didn't make a mistake in the money type.  As a C library
> > function it made sense to add the "$" to the display because it was
> > easy to add one to the return value if it wasn't required.  I'm finding
> > it to be a bit of a problem with my Python interface.  I was just
> > going to strip it in my module but I thought I would see if others
> > felt that it should simply be dropped from the PostgreSQL output.
> >
> Remove it! Those of us who aren't American/Canadian/Australian don't want
> a dollar sign for money anyway :-)

Right.  The original code that that comes from used locale extensively
for things like that.

Also, what about the commas?  Again, locale is supposed to be used to
determine which character to use but I am sure it just causes confusion.

In fact, perhaps we should just turn the money code into the decimal
type.  I understand we have a mechanism now for specifying an argument
to the input and output functions so we can specify the precision of
the decimal.  Is this correct?  If someone can help me out with the
type specifications, I'll start creating the code to handle decimal
types.  I'll just take the money code and modify it.

--
D'Arcy J.M. Cain <darcy@{druid|vex}.net>   |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 424 2871     (DoD#0082)    (eNTP)   |  what's for dinner.

Re: [HACKERS] Money type display

От
Bruce Momjian
Дата:
> In fact, perhaps we should just turn the money code into the decimal
> type.  I understand we have a mechanism now for specifying an argument
> to the input and output functions so we can specify the precision of
> the decimal.  Is this correct?  If someone can help me out with the
> type specifications, I'll start creating the code to handle decimal
> types.  I'll just take the money code and modify it.

Yep, it's in there.  atttypmod is passed to all input/output function as
the third argument.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [HACKERS] Money type display

От
Brett McCormick
Дата:
What's the second argument?

On Fri, 27 February 1998, at 12:19:34, Bruce Momjian wrote:

> Yep, it's in there.  atttypmod is passed to all input/output function as
> the third argument.
>
> --
> Bruce Momjian                          |  830 Blythe Avenue
> maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
>   +  If your life is a hard drive,     |  (610) 353-9879(w)
>   +  Christ can be your backup.        |  (610) 853-3000(h)

Re: [HACKERS] Money type displayt

От
Bruce Momjian
Дата:
>
>
> What's the second argument?
>
> On Fri, 27 February 1998, at 12:19:34, Bruce Momjian wrote:
>
> > Yep, it's in there.  atttypmod is passed to all input/output function as
> > the third argument.
> >

If it is an array, and the base type.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)