ClickHouse.Client
ClickHouse.Client copied to clipboard
Data reader `GetSchemaTable()` returns incorrectly-typed data
Column type is not configured in code and have default value (string).
E.g. AllowDBNull is string instead of bool.
https://github.com/DarkWanderer/ClickHouse.Client/blob/master/ClickHouse.Client/Utility/SchemaDescriber.cs
Hi @MaceWindu
Can you provide more details? (& ideally the list of columns where you see mismatch)
Sure:
using var cn = new ClickHouseConnection(cs);
cn.Open();
using var cmd = cn.CreateCommand();
cmd.CommandText = "select * from system.tables";
using var rd = cmd.ExecuteReader();
var schema = rd.GetSchemaTable();
if (schema.Rows[0]["AllowDBNull"] is not bool)
throw new InvalidOperationException("AllowDBNull should be bool");
I think you can use property types here for reference
https://docs.microsoft.com/en-us/dotnet/api/system.data.datacolumn?view=net-6.0