pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: PG Bug reporting form <noreply@postgresql.org>
To: pgsql-bugs@lists.postgresql.org
Cc: fpoliquin@gmail.com
Subject: BUG #17653: Bad handling of NUMERIC data type using ODBC driver version 13.2
Date: Wed, 19 Oct 2022 18:18:45 +0000
Message-ID: <17653-3658674dfcc466fe@postgresql.org> (raw)

The following bug has been logged on the website:

Bug reference:      17653
Logged by:          Frédéric Poliquin
Email address:      fpoliquin@gmail.com
PostgreSQL version: 11.16
Operating system:   Windows 10
Description:        

When doing math operations on numeric values, we often get a bad result when
using the ODBC driver.

Here is a short VBScript that reproduce the bug:

Set conn = CreateObject("ADODB.Connection")
conn.Open "Provider=MSDASQL;DRIVER=PostgreSQL
Unicode(x64);SERVER=xxx;DATABASE=xxx;UID=xxx;PWD=xxx;sslmode=require"
Set recordset = CreateObject("ADODB.Recordset")
recordset.Open "select 1000.000000000000000000000000000000000000 as val",
conn
WScript.echo recordset("val").Value

Just save the script in a "test.vbs" file, replace all "xxx" by the proper
values, install the latest ODBC x64 driver and execute in a console using
the command "cscript test.vbs".

The script will output the value "319,4352661581230730732507851" which makes
no sense. It should be "1000".

We don't have the bug when using DBeaver which points to the ODBC driver.

The server runs with Azure Database for Postgresql service.

If I cast the value to numeric(30,10), I don't have the error but it is a
dirty workaround which is very easy to forget.

Any help is appreciated.
Thank you.



Message-ID: <17653-3658674dfcc466fe@postgresql.org>
Permalink:  ../17653-3658674dfcc466fe@postgresql.org/
Also on:    postgresql.org/message-id/17653-3658674dfcc466fe@postgresql.org

 · 

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: pgsql-bugs@postgresql.org
  Cc: noreply@postgresql.org, pgsql-bugs@lists.postgresql.org, fpoliquin@gmail.com
  Subject: Re: BUG #17653: Bad handling of NUMERIC data type using ODBC driver version 13.2
  In-Reply-To: <17653-3658674dfcc466fe@postgresql.org>

* 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