Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKhru-0002lr-O0 for pgsql-odbc@arkaria.postgresql.org; Mon, 30 Aug 2021 14:02:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mKhrt-0003SS-HN for pgsql-odbc@arkaria.postgresql.org; Mon, 30 Aug 2021 14:02:33 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKhrt-0003SK-Bg for pgsql-odbc@lists.postgresql.org; Mon, 30 Aug 2021 14:02:33 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mKhrn-0008S6-2Q for pgsql-odbc@postgresql.org; Mon, 30 Aug 2021 14:02:32 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 17UE2PsN1348705; Mon, 30 Aug 2021 10:02:25 -0400 From: Tom Lane To: "James (Ke) Wang" cc: "pgsql-odbc@postgresql.org" Subject: Re: Bug? The precision from the ODBC API is not same to psql In-reply-to: References: Comments: In-reply-to "James (Ke) Wang" message dated "Mon, 30 Aug 2021 04:19:29 -0000" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1348703.1630332145.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 30 Aug 2021 10:02:25 -0400 Message-ID: <1348704.1630332145@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk "James (Ke) Wang" writes: > * PostgreSQL ODBC driver version: 13.01.00 > * PostgreSQL database version: PostgreSQL 10.17 on x86_64-pc-linux-g= nu, 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 f= rom 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=3D# select 51.3::float8; float8 = -------- 51.3 (1 row) regression=3D# set extra_float_digits =3D 2; SET regression=3D# 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