Re: Change of format of returned flat value after prepareThreshold

From: Michał Niklas <michal(dot)niklas(at)heuthes(dot)pl>
To:
Cc: List <pgsql-jdbc(at)postgresql(dot)org>
Subject: Re: Change of format of returned flat value after prepareThreshold
Date: 2015-10-19 08:44:35
Message-ID: 5624AD73.2070007@heuthes.pl
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-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

Attachment Content-Type Size
jdbc_pg_float_time.py.zip application/x-zip-compressed 1.1 KB

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Mikko Tiihonen 2015-10-19 09:25:36 Re: Change of format of returned flat value after prepareThreshold
Previous Message Thomas Kellerer 2015-10-16 17:37:32 Re: Release 1204 released