pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Tanel <tanel.ehrenpreis@finestmedia.ee>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: ResultSet getString() result differs in 8.3 jdbc (compared to 8.1), with "real" type
Date: Thu, 14 May 2009 14:45:49 -0400 (EDT)
Message-ID: <Pine.BSO.4.64.0905141441030.12930@leary.csoft.net> (raw)
In-Reply-To: <23536933.post@talk.nabble.com>
References: <23536933.post@talk.nabble.com>



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



view thread (5+ messages)  latest in thread

Message-ID: <Pine.BSO.4.64.0905141441030.12930@leary.csoft.net>
Permalink:  ../Pine.BSO.4.64.0905141441030.12930@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0905141441030.12930@leary.csoft.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: books@ejurka.com, tanel.ehrenpreis@finestmedia.ee
  Subject: Re: ResultSet getString() result differs in 8.3 jdbc (compared to 8.1), with "real" type
  In-Reply-To: <Pine.BSO.4.64.0905141441030.12930@leary.csoft.net>
  References: <23536933.post@talk.nabble.com> <Pine.BSO.4.64.0905141441030.12930@leary.csoft.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox