From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | DanixDefcon5 <danixdefcon5(at)gmail(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: Money deprecation and cast problem |
Date: | 2006-04-26 00:12:25 |
Message-ID: | Pine.BSO.4.63.0604251905280.1400@leary2.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Mon, 24 Apr 2006, DanixDefcon5 wrote:
> I know that the 'money' type is now deprecated, but I wonder why it is,
> and also ... how was it supposed to cast any other data type to 'money'
> anyway??? I checked the function list, per \df and couldn't find any
> function to do so, even though the money data type is basically an int4
> with the decimal point moved two places to the left. So....
>
> - Why did they deprecate it?
This is not a JDBC question. The -general list would be more appropriate
for this question.
When dealing with currency you are normally dealing with exact amounts and
should be using the numeric type instead of a wrapper around int.
You shouldn't be able to do:
jurka=# select '$9.99'::money / 10.0;
----------
$1.00
jurka=# select '$1,000,000'::money * 30;
-----------------
-$12,949,672.96
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Markus Schaber | 2006-04-26 08:30:51 | Re: Automated setting of timezone with connection pooling |
Previous Message | Kris Jurka | 2006-04-25 23:59:18 | Re: JDBC driver does not support getGeneratedKeys method |