public inbox for [email protected]  
help / color / mirror / Atom feed
From: Tom Lane <[email protected]>
To: James (Ke) Wang <[email protected]>
Cc: [email protected] <[email protected]>
Subject: Re: Bug? The precision from the ODBC API is not same to psql
Date: Mon, 30 Aug 2021 10:02:25 -0400
Message-ID: <[email protected]> (raw)
In-Reply-To: <DM6PR05MB5339E42B06B5BBEE571F3C6995CB9@DM6PR05MB5339.namprd05.prod.outlook.com>
References: <DM6PR05MB5339E42B06B5BBEE571F3C6995CB9@DM6PR05MB5339.namprd05.prod.outlook.com>

"James (Ke) Wang" <[email protected]> writes:
>   *   PostgreSQL ODBC driver version: 13.01.00
>   *   PostgreSQL database version: PostgreSQL 10.17 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44), 64-bit
>   *   any error messages you saw on the screen: No. However the result from ODBC API is not expected, we expect the ODBC driver returns the result same to Psql utility. Please see the below logs.

You can get the same result in psql, if you set extra_float_digits
correctly:

regression=# select 51.3::float8;
 float8 
--------
   51.3
(1 row)
regression=# set extra_float_digits = 2;
SET
regression=# select 51.3::float8;
       float8       
--------------------
 51.299999999999997
(1 row)

So presumably either ODBC or something in your application is
setting that parameter.

FWIW, PG version 12 and newer won't do that; they use a newer
floating-point printing algorithm with less inclination to
produce silly-looking results.

			regards, tom lane






view thread (2+ messages)

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 using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Bug? The precision from the ODBC API is not same to psql
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox