ClickHouse / clickhouse-odbc

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

System.Data.Odbc.OdbcException on not UTF8 symbol in CH #383

Open zabavin opened 2 years ago

zabavin commented 2 years ago

��oztt@mail.ru (string) field

select email from hhh Error in data CH (not UTF8 symbol)

System.Data.Odbc.OdbcException HResult=0x80131937 Сообщение = ERROR [HY000] bad conversion Источник = CLICKHOUSEODBCW.DLL Трассировка стека: в System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) в System.Data.Odbc.OdbcDataReader.GetData(Int32 i, SQL_C sqlctype, Int32 cb, Int32& cbLengthOrIndicator) в System.Data.Odbc.OdbcDataReader.internalGetString(Int32 i) в System.Data.Odbc.OdbcDataReader.GetValue(Int32 i, TypeMap typemap) в System.Data.Odbc.OdbcDataReader.GetValue(Int32 i) в Click2Postgres.Program.fn_gen_table_schema(Int32 buff_cnt, NpgsqlConnection pg_conn, String dwh_sql, String pg_sql) в
в Click2Postgres.Program.Main(String[] args)

savelov commented 2 years ago

this usually means wrong character encoding conversion (either in your data, inbound flows or outbound flows). you need to find the row/column which contains the wrong data and then fix the root cause. Assuming you found the row/column - this is email with first invalid UTF8 characters in string field - ��oztt@mail.ru (string) field

zabavin commented 2 years ago

I understand, but I can't manage the data. I'm just taking them. I cannot process this c# try {}catch{} error to result in a driver. Maybe you can come up with something