pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michał Niklas <michal.niklas@heuthes.pl>
Cc: List <pgsql-jdbc@postgresql.org>
Subject: Re: Change of format of returned flat value after prepareThreshold
Date: Mon, 19 Oct 2015 10:44:35 +0200
Message-ID: <5624AD73.2070007@heuthes.pl> (raw)
In-Reply-To: <CAB=Je-F5k+wDDU3V4YE+pSyVK7rDOMmucoQy8wnPK7gFEJeh1g@mail.gmail.com>
References: <561F9990.10702@heuthes.pl>
	<CAB=Je-H_Q0ezjcBM9gCta=wVZyUKs+7WExwKRuJRdhssq9B8Bg@mail.gmail.com>
	<56208B5C.9090803@heuthes.pl>
	<CAB=Je-F5k+wDDU3V4YE+pSyVK7rDOMmucoQy8wnPK7gFEJeh1g@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-jdbc>

W dniu 16.10.2015 o 12:15, Vladimir Sitnikov pisze:
> [...]
>> If I set prepareThreshold=5 then I get float in normal notation
>> up to 5th try, and then from 6th try I get this value in
>> scientific notation.
> 
> Well, that is thanks to usage of server-prepared statement. In that
> mode, pgjdbc can use binary format of data transfer. It does use
> binary mode for types it knows as it is more efficient to transfer 
> and parse.

OK, but I think string representation of such float should
not change during program life.

I tested JDBC driver with much simpler query:
SELECT 1445006113904::float8
so there is known, constant number.

Up to prepareThreshold I got: 1445006113904,
then I got: 1.445006113904E12

I think it is bug because I expect to have the same
string representation of such number regardless
of prepareThreshold. It may be normal or scientific
notation, but SELECT for known, constant parameters
should give the known output. Now output is inconsistent.

In attachment there is Jython code that on my machine
shows:

jdbc:postgresql://test-baza.heuthesd:5494/isof_test?stringtype=unspecified&prepareThreshold=2
--------------
PostgreSQL 9.4.5 on x86_64-unknown-linux-gnu, compiled by gcc (GCC)
4.4.7 20120313 (Red Hat 4.4.7-16), 64-bit
JDBC driver version is 'PostgreSQL 9.4 JDBC4.2 (build 1204)'; major:
9; minor: 4

testing with query: SELECT 1445006113904::float8

--- 1 ---
column type: float8 (8); java: java.lang.Double; precision: 17; scale: 17
getString(): 1445006113904
--- 2 ---
column type: float8 (8); java: java.lang.Double; precision: 17; scale: 17
getString(): 1445006113904
--- 3 ---
column type: float8 (8); java: java.lang.Double; precision: 17; scale: 17
getString(): 1.445006113904E12
		STRING FORMAT CHANGED!!!



-- 
Regards,
Michał Niklas

-- 
Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-jdbc

Attachments:

  jdbc_pg_float_time.py.zip (application/x-zip-compressed, 1.1K) download

view thread (12+ messages)  latest in thread

Message-ID: <5624AD73.2070007@heuthes.pl>
Permalink:  ../5624AD73.2070007@heuthes.pl/
Also on:    postgresql.org/message-id/5624AD73.2070007@heuthes.pl

 · 

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: michal.niklas@heuthes.pl
  Subject: Re: Change of format of returned flat value after prepareThreshold
  In-Reply-To: <5624AD73.2070007@heuthes.pl>
  References: <561F9990.10702@heuthes.pl> <CAB=Je-H_Q0ezjcBM9gCta=wVZyUKs+7WExwKRuJRdhssq9B8Bg@mail.gmail.com> <56208B5C.9090803@heuthes.pl> <CAB=Je-F5k+wDDU3V4YE+pSyVK7rDOMmucoQy8wnPK7gFEJeh1g@mail.gmail.com> <5624AD73.2070007@heuthes.pl>

* 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