Re: Bug? The precision from the ODBC API is not same to psql - Mailing list pgsql-odbc

From Tom Lane
Subject Re: Bug? The precision from the ODBC API is not same to psql
Date
Msg-id 1348704.1630332145@sss.pgh.pa.us
Whole thread Raw
In response to Bug? The precision from the ODBC API is not same to psql  ("James (Ke) Wang" <james.wang@sas.com>)
List pgsql-odbc
"James (Ke) Wang" <james.wang@sas.com> 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
Hat4.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
ODBCdriver 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



pgsql-odbc by date:

Previous
From: "James (Ke) Wang"
Date:
Subject: The precision from the ODBC API is not same to psql
Next
From: Andreas Beier
Date:
Subject: Excel ODBC query loosing parameter when returning the query result directly to a pivot table.