Skip to content

Backslashes in a string query parameter seem to be interpreted inconsistently #69656

@depressed-pho

Description

@depressed-pho

Describe the unexpected behaviour

Backslashes in a string query parameter seem to be interpreted in an inconsistent way. This behavior exhibits on version 24.7.1.

A single backslash \ results in an error:

% clickhouse-client --param_message="hello\\" --query="SELECT {message: String}"
Received exception from server (version 24.7.1):
Code: 25. DB::Exception: Received from localhost:9000. DB::Exception: Cannot par
se escape sequence: value hello\ cannot be parsed as String for query parameter
'message'. (CANNOT_PARSE_ESCAPE_SEQUENCE)
(query: SELECT {message: String})

A double backslash \\ is left unchanged:

% clickhouse-client --param_message="hello\\\\" --query="SELECT {message: String}"
hello\\

A sequence of two characters \ and n is left unchanged too:

% clickhouse-client --param_message="hello\\n" --query="SELECT {message: String}"
hello\n

Expected behavior

I don't know what to expect here, i.e. I don't know whether escape sequences in string query parameters should be interpreted or not. But at least there should be a consistency. One cannot enter a string with a single \ as a query parameter currently.

Metadata

Metadata

Assignees

No one assigned

    Labels

    unexpected behaviourResult is unexpected, but not entirely wrong at the same time.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions