Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data reader GetSchemaTable() returns incorrectly-typed data #128

Open
MaceWindu opened this issue Jun 3, 2022 · 3 comments
Open

Data reader GetSchemaTable() returns incorrectly-typed data #128

MaceWindu opened this issue Jun 3, 2022 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@MaceWindu
Copy link

MaceWindu commented Jun 3, 2022

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

@DarkWanderer DarkWanderer self-assigned this Jun 18, 2022
@DarkWanderer DarkWanderer added the bug Something isn't working label Jun 18, 2022
@DarkWanderer
Copy link
Owner

Hi @MaceWindu

Can you provide more details? (& ideally the list of columns where you see mismatch)

@MaceWindu
Copy link
Author

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");

@MaceWindu
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants