You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I use ODBC.jl to execute the query like SELECT CAST(-1.5 AS DECIMAL(2,1)), I get back the value -1.0 instead of the expected -1.5. Depending on the database server, a query as simple as SELECT -1.5 can demonstrate the issue. The problem is that the receiving buffer allocated by ODBC.jl is too small to hold the complete value.
Here's the code to quickly reproduce the issue:
using ODBC
using DataFrames
const dsn =ENV["DSN"]
const sql ="SELECT CAST(-1.5 AS DECIMAL(2,1))"#const sql = "SELECT -1.5"const conn = ODBC.Connection(dsn)
const cr = DBInterface.execute(conn, sql)
display(cr.metadata)
display(DataFrame(cr))
Notably, the column size reported by the ODBC driver is 3-1=2, apparently, the precision of the decimal number and not the size of the receiving buffer. I also ran this code and got the same result against three other drivers: for PostgreSQL, MariaDB, and Databricks.
The text was updated successfully, but these errors were encountered:
When I use ODBC.jl to execute the query like
SELECT CAST(-1.5 AS DECIMAL(2,1))
, I get back the value-1.0
instead of the expected-1.5
. Depending on the database server, a query as simple asSELECT -1.5
can demonstrate the issue. The problem is that the receiving buffer allocated by ODBC.jl is too small to hold the complete value.Here's the code to quickly reproduce the issue:
The output, for MS SQL Server, is:
Notably, the column size reported by the ODBC driver is 3-1=2, apparently, the precision of the decimal number and not the size of the receiving buffer. I also ran this code and got the same result against three other drivers: for PostgreSQL, MariaDB, and Databricks.
The text was updated successfully, but these errors were encountered: