ClickHouse / clickhouse-odbc

ODBC driver for ClickHouse
https://clickhouse.tech
Apache License 2.0
246 stars 88 forks source link

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

Open yingxu9871 opened 1 year ago

yingxu9871 commented 1 year ago

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() .