使用CSV文件在字符串字段中使用单引号进行插入会导致错误

问题描述

使用CSV文件在字符串字段中使用单引号进行插入会导致类似情况的错误

"'Catbug' Animated Series In The Works From 'Adventure Time ..."

但是其他带有单引号的方案成功加载。有没有解决此问题的方法

解决方法

使用 format_csv_allow_single_quotes -parameter不能将单引号解释为分号:

echo "'Catbug' Animated Series In The Works From 'Adventure Time ..." |
    clickhouse-client --query "insert into test format CSV" --format_csv_allow_single_quotes 0

echo "'Catbug' Animated Series In The Works From 'Adventure Time ..." |
    clickhouse-client --query "insert into test format CSV settings format_csv_allow_single_quotes=0"
,

clickhouse-client --format_csv_allow_single_quotes = 0

这是因为CH使用第一个字符'或'

来自动发现使用的引号