Thread: BUG #17653: Bad handling of NUMERIC data type using ODBC driver version 13.2
BUG #17653: Bad handling of NUMERIC data type using ODBC driver version 13.2
From
PG Bug reporting form
Date:
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.