Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id 417EC632F0D for ; Wed, 20 Jan 2010 00:44:00 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 55260-10 for ; Wed, 20 Jan 2010 04:43:49 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.vnet-inc.com (outbound.vnet-inc.com [216.146.104.103]) by mail.postgresql.org (Postfix) with ESMTP id C07D463225B for ; Wed, 20 Jan 2010 00:43:49 -0400 (AST) Received: from [192.168.157.32] (unknown [216.129.226.60]) by outbound.vnet-inc.com (Postfix) with ESMTP id 202EF592B for ; Tue, 19 Jan 2010 21:43:50 -0700 (MST) Message-ID: <4B568642.1000004@ttc-cmc.net> Date: Tue, 19 Jan 2010 21:27:46 -0700 From: dmp User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.13) Gecko/20060417 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: Re: Mapping Java BigDecimal References: <4B540B7D.1080306@b2bcentrum.cz> <4B541C40.9040206@postnewspapers.com.au> <407d949e1001180209v39e46a88v6d5a0e5a181a5d84@mail.gmail.com> <4B55371B.40105@postnewspapers.com.au> <407d949e1001190304m1bfea314ta5bd89e035d01c9@mail.gmail.com> <4B55C8D3.7090907@ttc-cmc.net> In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-0.74 tagged_above=-10 required=5 tests=BAYES_20=-0.74 X-Spam-Level: X-Archive-Number: 201001/55 X-Sequence-Number: 20251 > I would like to disagree with the statement that PostgreSQL > numeric is a real with rounding to the precision specified. I concede my mis-statement. > Hi All, > > We decide add support PostgreSQL database (now supporting only Oracle > database) to our product. > > In Oracle we mapping Java BigDecimal to number(19, 2), in PostgreSQL > to numeric(19, 2). > > If I store to "BigDecimal column" number without decimal, e.g. "3", > than Oracle JDBC driver return "3", but PostgreSQL JDBC driver return > "3.00". > > Is there some way (mapping, server setup, jdbc driver setup,...) how > reach return number without trailing zeroes on decimal position? > > I'm using JDBC4 PostgreSQL Driver (v. 8.4-701) and PostgreSQL v. > 8.1.18 (default for CentoOS 5.3). > Thank you all Oracle NUMBER(19,2), (precision,scale) is just the same as NUMERIC(19,2), but if do Oracle NUMBER(19,2) ----> PostgreSQL Numeric, no precision yields the desired result as Jakub has figured out and keeps whatever precision input. danap.