Re: ResultSet getString() result differs in 8.3 jdbc (compared to 8.1), with "real" type

From: Kris Jurka <books(at)ejurka(dot)com>
To: Tanel <tanel(dot)ehrenpreis(at)finestmedia(dot)ee>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: ResultSet getString() result differs in 8.3 jdbc (compared to 8.1), with "real" type
Date: 2009-05-14 18:45:49
Message-ID: Pine.BSO.4.64.0905141441030.12930@leary.csoft.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

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

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2009-05-14 18:46:43 Re: v604 in Maven
Previous Message Kris Jurka 2009-05-14 18:45:11 Re: prepared statement not working