Skip to content

Prepared statement IN with Date as value #2557

@KrutNA

Description

@KrutNA

Description

Steps to reproduce

  1. Created any table with field of type Date
  2. Inserted any data
  3. Trying to fetch with prepared statement SELECT ... WHERE ... IN (?)

Error Log or Exception StackTrace

Exception in thread "main" java.sql.SQLException: Code: 53. DB::Exception: Type mismatch in IN or VALUES section. Expected: Date. Got: Decimal64. (TYPE_MISMATCH) (version 24.12.4.49 (official build))
        at com.clickhouse.jdbc.internal.ExceptionUtils.toSqlState(ExceptionUtils.java:67)
        at com.clickhouse.jdbc.internal.ExceptionUtils.toSqlState(ExceptionUtils.java:42)
        at com.clickhouse.jdbc.StatementImpl.executeQueryImpl(StatementImpl.java:164)
        at com.clickhouse.jdbc.PreparedStatementImpl.executeQuery(PreparedStatementImpl.java:142)
        at com.krutna.mre.clickhousejdbc.Mre.select(Mre.java:78)
        at com.krutna.mre.clickhousejdbc.Mre.main(Mre.java:52)
Caused by: com.clickhouse.client.api.ServerException: Code: 53. DB::Exception: Type mismatch in IN or VALUES section. Expected: Date. Got: Decimal64. (TYPE_MISMATCH) (version 24.12.4.49 (official build))
        at com.clickhouse.client.api.internal.HttpAPIClientHelper.readError(HttpAPIClientHelper.java:405)
        at com.clickhouse.client.api.internal.HttpAPIClientHelper.executeRequest(HttpAPIClientHelper.java:461)
        at com.clickhouse.client.api.Client.lambda$query$5(Client.java:1588)
        at com.clickhouse.client.api.Client.runAsyncOperation(Client.java:1999)
        at com.clickhouse.client.api.Client.query(Client.java:1632)
        at com.clickhouse.client.api.Client.query(Client.java:1532)
        at com.clickhouse.jdbc.StatementImpl.executeQueryImpl(StatementImpl.java:141)

Expected Behaviour

Code Example

https://github.com/KrutNA/clickhouse-bug-mre/

Environment

  • Cloud
  • Client version: 0.9.1
  • Language version:
  • OS:

ClickHouse Server

  • ClickHouse Server version: 24.12.4.49

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions