pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Vladimir Sitnikov <sitnikov.vladimir@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: Andreas Joseph Krogh <andreas@visena.com>
Cc: Thangavel, Parameswaran <Parameswaran.Thangavel@rsa.com>
Cc: pgsql-jdbc@postgresql.org <pgsql-jdbc@postgresql.org>
Subject: Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
Date: Tue, 20 Oct 2020 16:33:06 -0400
Message-ID: <675895.1603225986@sss.pgh.pa.us> (raw)
In-Reply-To: <CAB=Je-H8NiTt_+roUXzv=UiL6QWG-7QzihMVvpXrwyq8FLuo3w@mail.gmail.com>
References: <CH2PR19MB3798B6096BD4EA60C2068367831F0@CH2PR19MB3798.namprd19.prod.outlook.com>
	<VisenaEmail.9.b226ab802321bcdc.17544a6d3e3@tc7-visena>
	<CH2PR19MB3798DAEA77750DD4F4CE67A0831F0@CH2PR19MB3798.namprd19.prod.outlook.com>
	<VisenaEmail.e.3213a432433c7179.17544c1d629@tc7-visena>
	<CAKFQuwbbYTc63HeEBPXcDzPU28Do4z+y9ZEwQKVFwCnbPP1FaQ@mail.gmail.com>
	<VisenaEmail.90.b09bf69bfcec8e52.17546ec4f83@tc7-visena>
	<652597.1603214274@sss.pgh.pa.us>
	<VisenaEmail.91.1593ba84a90d02a5.17547533c82@tc7-visena>
	<CAKFQuwYwsp7-5WUPsgg_ZpbtOOQ9kuvbEsD1LWLboz2qD80uwQ@mail.gmail.com>
	<VisenaEmail.98.ebf0ca280ce8e2b7.175476a101e@tc7-visena>
	<CAKFQuwYa=VsYuhCYEn+jCWc_s52h-oOVRzL696iQSJKHHbELOg@mail.gmail.com>
	<674136.1603223598@sss.pgh.pa.us>
	<CAB=Je-H8NiTt_+roUXzv=UiL6QWG-7QzihMVvpXrwyq8FLuo3w@mail.gmail.com>

Vladimir Sitnikov <sitnikov.vladimir@gmail.com> writes:
> https://www.postgresql.org/docs/13/datatype-numeric.html#DATATYPE-FLOAT
> The documentation says that PostgreSQL implements IEEE Standard 754.

Note the waffling immediately after that, though.

> 1234567 is exactly representable in IEEE (e.g. see
> https://www.exploringbinary.com/floating-point-converter/ ),
> so I would expect the database should keep the value intact.

You don't really get to have your cake and eat it too.  Yeah, we
could allow more than six digits to propagate through float4_numeric,
but then some cases would result in surprising garbage digits showing
up in the result.  That would annoy at least as many people as the
current behavior.

> In case that matters, pgjdbc does send pass extra_float_digits=2 in the
> initial packet, then it upgrades to extra_float_digist=3 in case server
> version is 9.0+

Hmm, but it's done that for a long while, no?  Doesn't seem to explain
the behavior change the OP is complaining of.

> I did try removing that parameter, and it does not resolve
> 1234567::float4::numeric::text issue

Of course not, that conversion is happening entirely inside the
backend; extra_float_digits isn't involved.  (Although it would
get involved with 1234567::float4::text::numeric, I bet, since
the float4 -> text step would pay attention to it.)

			regards, tom lane





view thread (19+ messages)  latest in thread

Message-ID: <675895.1603225986@sss.pgh.pa.us>
Permalink:  ../675895.1603225986@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/675895.1603225986@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, sitnikov.vladimir@gmail.com, david.g.johnston@gmail.com, andreas@visena.com, Parameswaran.Thangavel@rsa.com
  Subject: Re: PostgresSQL 10 | Driver 42.2.5 | Float Conversion Issue
  In-Reply-To: <675895.1603225986@sss.pgh.pa.us>
  References: <CH2PR19MB3798B6096BD4EA60C2068367831F0@CH2PR19MB3798.namprd19.prod.outlook.com> <VisenaEmail.9.b226ab802321bcdc.17544a6d3e3@tc7-visena> <CH2PR19MB3798DAEA77750DD4F4CE67A0831F0@CH2PR19MB3798.namprd19.prod.outlook.com> <VisenaEmail.e.3213a432433c7179.17544c1d629@tc7-visena> <CAKFQuwbbYTc63HeEBPXcDzPU28Do4z+y9ZEwQKVFwCnbPP1FaQ@mail.gmail.com> <VisenaEmail.90.b09bf69bfcec8e52.17546ec4f83@tc7-visena> <652597.1603214274@sss.pgh.pa.us> <VisenaEmail.91.1593ba84a90d02a5.17547533c82@tc7-visena> <CAKFQuwYwsp7-5WUPsgg_ZpbtOOQ9kuvbEsD1LWLboz2qD80uwQ@mail.gmail.com> <VisenaEmail.98.ebf0ca280ce8e2b7.175476a101e@tc7-visena> <CAKFQuwYa=VsYuhCYEn+jCWc_s52h-oOVRzL696iQSJKHHbELOg@mail.gmail.com> <674136.1603223598@sss.pgh.pa.us> <CAB=Je-H8NiTt_+roUXzv=UiL6QWG-7QzihMVvpXrwyq8FLuo3w@mail.gmail.com> <675895.1603225986@sss.pgh.pa.us>

* 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