X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (mx1.hub.org [200.46.208.251]) by postgresql.org (Postfix) with ESMTP id BC2A711F6081 for ; Tue, 25 Apr 2006 21:20:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.208.251]) (amavisd-new, port 10024) with ESMTP id 62532-04 for ; Tue, 25 Apr 2006 21:19:55 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 240DB11F6097 for ; Tue, 25 Apr 2006 21:19:53 -0300 (ADT) Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by svr4.postgresql.org (Postfix) with SMTP id 0FF8F5B3067 for ; Wed, 26 Apr 2006 00:19:42 +0000 (GMT) Received: (qmail 17333 invoked by uid 1112); 26 Apr 2006 00:12:25 -0000 Date: Tue, 25 Apr 2006 19:12:25 -0500 (EST) From: Kris Jurka X-X-Sender: books@leary2.csoft.net To: DanixDefcon5 Cc: pgsql-jdbc@postgresql.org Subject: Re: Money deprecation and cast problem In-Reply-To: <1145905148.140026.134730@g10g2000cwb.googlegroups.com> Message-ID: References: <1145905148.140026.134730@g10g2000cwb.googlegroups.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200604/158 X-Sequence-Number: 15092 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