From: Michael Nacos <m.nacos@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: real -> numeric -> real result different through jdbc
Date: Fri, 11 Dec 2009 16:54:09 +0000
Message-ID: <407fa4640912110854y551f47d8q6ba4acb048cdd4f9@mail.gmail.com> (raw)
In-Reply-To: <19400.1260548963@sss.pgh.pa.us>
References: <407fa4640912110805m67b2bdfr8e4ff703647b6f8b@mail.gmail.com>
<19400.1260548963@sss.pgh.pa.us>
2009/12/11 Tom Lane <tgl@sss.pgh.pa.us>
> I seem to recall hearing that JDBC fools with the extra_float_digits
> setting. The "0.60000002" looks like it probably is the actual result
> of casting 0.6 to float4 --- remember float4 is only good to about six
> decimal digits. The default display of float4 rounds off at six digits,
> but in some contexts you don't want that rounding to happen because it
> might result in losing even more precision. JDBC is being conservative
> and taking the latter approach.
>
thanks tom,
we have just discovered this setting hidden away in
ConnectionFactoryImpl.java of the JDBC sources.
surely, it's not just a case of float4 display, type casting seems to be
affected, too.
does casting use the default display or does the internal representation
change?
It is causing our regression tests, which test for equality at the SQL
level, to fail.
cheers, Michael
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: m.nacos@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: real -> numeric -> real result different through jdbc
In-Reply-To: <407fa4640912110854y551f47d8q6ba4acb048cdd4f9@mail.gmail.com>
References: <407fa4640912110805m67b2bdfr8e4ff703647b6f8b@mail.gmail.com> <19400.1260548963@sss.pgh.pa.us> <407fa4640912110854y551f47d8q6ba4acb048cdd4f9@mail.gmail.com>
* 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