Re: [HACKERS] Datatype MONEY - Mailing list pgsql-hackers

From wieck@debis.com (Jan Wieck)
Subject Re: [HACKERS] Datatype MONEY
Date
Msg-id m11xUgo-0003kGC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to Re: [HACKERS] Datatype MONEY  (Karel Zak - Zakkr <zakkr@zf.jcu.cz>)
Responses Re: [HACKERS] Datatype MONEY
List pgsql-hackers
Karel Zak - Zakkr wrote:

> On Mon, 13 Dec 1999, Michael Meskes wrote:
>
> > I somehow remember the MONEY datatype has some problems and might be
> > removed. Now I didn=B4t follow this topic closely enough, but now I've
> > encountered I could use it pretty well. Of course a DECIMAL datatype fi=
> ts
> > the bill as good since I do not need the currency symbol in psql's outp=
> ut.
> >=20
> > Before I set up my DB I'd like to know which type to prefer.
> >=20
> > Michael
>
>  I have complete code for numbers formatting (to_char() compatible with
> Oracle). It allow you add a currency symbol corresponding with current
> locale ... and more features over basic datatypes (float4/8, int4/8).
>
> I send it to the PACHES list next week (probably). =20
>
>
> Example:
>
> template1=3D> select float8_to_char(455.9 , 'L999D99') as price;
> price
> ---------
> Kc 455,90
> (1 row)
>
> (It is with Czech currency symbol and decimal point (locales))
>
> IMHO is good use for money a float type.

    In  some  countries  (Germany  at least) storage of financial
    booking information is not permitted to use floats.  And  you
    aren't  allowed  to  use  it  for  calculation of taxes etc.,
    instead you must use some datatype with a fixable  number  of
    digits after the decimal point.

    Thus,  only  our NUMERIC/DECIMAL type or int4/8 and using the
    'V' (IIRC) format specifier in to_char() should be used.


Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me.                                  #
#========================================= wieck@debis.com (Jan Wieck) #

pgsql-hackers by date:

Previous
From: Karel Zak - Zakkr
Date:
Subject: Re: [HACKERS] createdb with alternate location
Next
From: Mike Mascari
Date:
Subject: Is something wrong here?