Octonica / ClickHouseClient

ClickHouse .NET Core driver
Apache License 2.0
140 stars 23 forks source link

Error when using System.DateTime to populate Clickhouse field of type DateTime64(7, 'UTC') #78

Closed kboniadi closed 1 year ago

kboniadi commented 1 year ago

As the title explains, I'm getting an error when trying to insert a C# DateTime or DateTimeOffset object into a clickhouse field of type DateTime64(7, 'UTC') when using Dapper. Inserts work just fine when the clickhouse field is a plain DateTime type. Below is the error that I'm getting

Octonica.ClickHouseClient.Exceptions.ClickHouseServerException: DB::Exception: Type mismatch in IN or VALUES section. Expected: DateTime64(7, 'UTC'). Got: UInt64: While executing ValuesBlockInputFormat Does anyone have a fix or know why this is happening for the DateTime64 type only? As a side note, this also seems to be happening with Date32 as well.

kboniadi commented 1 year ago

I'm going to close this ticket. Updating to Clickhouse 23.5 seems to have fixed this issue.