Insert fails if insert field carries ' character
Opened this issue · 4 comments
Insert fails if insert field carries ' character and throw exception "cannot parse expression
of type String here"
Insert fails if insert field carries ' character and throw exception "cannot parse expression of type String here"
hello there, this exception is throw by clickhouse server,it can't parase the String with single quotes .
we need to escape at least ' and .
https://clickhouse.com/docs/en/sql-reference/syntax/
Insert fails if insert field carries ' character and throw exception "cannot parse expression of type String here"
hello there, this exception is throw by clickhouse server,it can't parase the String with single quotes . we need to escape at least ' and . https://clickhouse.com/docs/en/sql-reference/syntax/
@SulphurFH I also met the same problem, how did you solve it?
Insert fails if insert field carries ' character and throw exception "cannot parse expression of type String here"
hello there, this exception is throw by clickhouse server,it can't parase the String with single quotes . we need to escape at least ' and . https://clickhouse.com/docs/en/sql-reference/syntax/
@SulphurFH I also met the same problem, how did you solve it?
Only string literals in single quotes are supported. The enclosed characters can be backslash-escaped. The following escape sequences have a corresponding special value: \b, \f, \r, \n, \t, \0, \a, \v, \xHH. In all other cases, escape sequences in the format \c, where c is any character, are converted to c. It means that you can use the sequences 'and\. The value will have the String type.
In string literals, you need to escape at least ' and . Single quotes can be escaped with the single quote, literals 'It's' and 'It''s' are equal.
@luffy0223
Thanks for your work.
I have a question,Whether to consider using JSONEachRow to insert data.
Format data to json will avoid data parsing problems on clickhouse server caused by special characters。
Are there any special considerations on choice VALUES
model ?
VALUES: $ echo '(4),(5),(6)' | curl 'http://localhost:8123/?query=INSERT%20INTO%20t%20VALUES' --data-binary @-
FORMAT: $ echo -ne '10\n11\n12\n' | curl 'http://localhost:8123/?query=INSERT%20INTO%20t%20FORMAT%20TabSeparated' --data-binary @-