Skip to content

fix: escape control characters in query parameter values#1807

Draft
daniell-canva wants to merge 1 commit intoClickHouse:mainfrom
daniell-canva:fix/query-param-tsv-escaping
Draft

fix: escape control characters in query parameter values#1807
daniell-canva wants to merge 1 commit intoClickHouse:mainfrom
daniell-canva:fix/query-param-tsv-escaping

Conversation

@daniell-canva
Copy link
Copy Markdown

draft

Named query parameters are deserialized by ClickHouse using
deserializeTextEscaped (TSV format). A raw tab byte (0x09) is treated
as a TSV field delimiter and causes error 457 (BAD_QUERY_PARAMETER):
"isn't parsed completely".

Fix encodeFieldDump (native TCP path) to TSV-escape control characters
(\t, \n, \r, \\, \0) before sending over the wire. Add escapeQueryParam
for the same escaping on the HTTP path, where values are sent as URL
query parameters.

This matches the behaviour of the official C++ and Python ClickHouse
SDKs, which both apply escaping transparently so callers can pass raw
Go/Python string values without knowing the wire format.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants