ClickHouse / clickhouse-odbc

ODBC driver for ClickHouse

Home Page:https://clickhouse.tech

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fail to get correct precison and scale of decimal through ODBC SQLDescribeColW()

yingxu9871 opened this issue · comments

Environment:
Clickhouse ODBC driver version: latest one downloaded from https://github.com/ClickHouse/clickhouse-odbc/releases/download/v1.2.1.20220905/clickhouse-odbc-windows.zip
Windows 10

Steps:

  1. create and insert data by SQL:
    CREATE TABLE test_decimal_X
    (
    id String,
    test_decimal Decimal(18,10)
    )
    ENGINE = MergeTree
    ORDER BY id

INSERT INTO test_decimal_X VALUES('2',10.12)

  1. set up ODBC connection

  2. After setting up odbc connection, we use SQLDescribeColW() (written in c++ ) to get precision and scale of decimal, but get result: type=decimal,precision=41,scale=0, 4.

  3. The sql I execute is: SELECT T0.id AS id,T0.test_decimal AS test_decimal FROM test_decimal_X T0. The error I get is : HY000[1] Cannot interpret ‘10.12’ as signed 64-bit integer: Cannot string consumed partially.

Expectation:
Expect to get correct precision and scale of decimal through SQLDescribeColW() .