Search Postgresql Archives

Re: Money casting too liberal?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2013-03-28, D'Arcy J.M. Cain <darcy@xxxxxxxxx> wrote:
>
> I would like to see the type handle other situations such as foreign
> (to me) currency, etc.  I suppose a positional parameter and a currency
> string setting would handle most of those issues.  Technically, the
> money type is a cents type.  Everything is stored as the number of
> cents.  Formatting it as dollars and cents is a convenience added by
> the I/O functions.

it actually does that, if you have the locale installed you can set
LC_MONETARY to  Japan  and get no decimals and a Yen symbol 
or to UAE and get three decimals and their currency symbol.

> Even as the author I sometimes go with numeric but there is a place for
> the type.  If you are working with simple dollars and cents quantities
> and you need to do lots of calculations on them, the money type can be
> a great performance boost.  The big win that money brings is that
> everything is stored as an int.  That means that you don't need to
> convert data in the database to a machine representation before
> summing, averaging, etc.  The machine can generally work on the data as
> it comes out of the DB.

it'd be nice to be able to do a money * numeric operation 

currently multiplication is done in floating point and this can give
unexpected results.

>
> -- 
> D'Arcy J.M. Cain <darcy@xxxxxxxxx>         |  Democracy is three wolves
> http://www.druid.net/darcy/                |  and a sheep voting on
> +1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.
> IM: darcy@xxxxxxx, VOIP: sip:darcy@xxxxxxx
>
>


-- 
⚂⚃ 100% natural



-- 
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux