Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id 23BF863529F for ; Thu, 14 May 2009 15:45:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 57836-04-4 for ; Thu, 14 May 2009 15:45:47 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 4972E635236 for ; Thu, 14 May 2009 15:45:50 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id 934C7A9A8; Thu, 14 May 2009 14:45:49 -0400 (EDT) Date: Thu, 14 May 2009 14:45:49 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Tanel cc: pgsql-jdbc@postgresql.org Subject: Re: ResultSet getString() result differs in 8.3 jdbc (compared to 8.1), with "real" type In-Reply-To: <23536933.post@talk.nabble.com> Message-ID: References: <23536933.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.009 tagged_above=0 required=5 tests=AWL=0.009 X-Spam-Level: X-Archive-Number: 200905/81 X-Sequence-Number: 19631 On Thu, 14 May 2009, Tanel wrote: > I made some searches also, however found nothing exactly related to this > problem. We just shifted from using 8.1 driver to 8.3 however seems that 8.3 > driver handles differently Postgresql floating type values, when using > org.postgresql.jdbc2.AbstractJdbc2ResultSet.java getString() on them ? > For example, when there is "real" type value 20.7 in database and we try to > get it through getString() then old 8.1 driver returns nicely 20.7, but new > 8.3 driver is returning something like 20.700001. > > So my question would be that if such getString() behaviour is desired (?) > (it is also in 8.4 driver), then can someone please give an hint where > exactly can this behaviour be manipulated/turned off/etc... ? > The setting that changed is extra_float_digits. The newer driver is setting it to two rather than the default zero to restore float values as accurately as possible. You can override this by issuing your own SET command upon connection. http://www.postgresql.org/docs/8.3/static/runtime-config-client.html#RUNTIME-CONFIG-CLIENT-FORMAT Kris Jurka