You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
clickhouse-client does not properly handle the case when both immediate data and stdin are present. #36100
CREATE TABLE test (a String, b String) ENGINE = Memory
This command properly displaying the error about mismatching number of columns:
echo "(1, 2, 3)" | clickhouse-client --query "
INSERT INTO test
SELECT 'Hello', 'World'
FROM input('x UInt32')
FORMAT Values"
This command also works properly, displaying the error:
echo "(1, 2, 3)" | clickhouse-client --query "
INSERT INTO test
SELECT 'Hello', 'World'
FROM input('x UInt32')
FORMAT Values
"
But this displays nothing:
echo "(1, 2, 3)" | clickhouse-client --query "
INSERT INTO test
SELECT 'Hello', 'World'
FROM input('x UInt32')
FORMAT Values
"
It happens, because the last command has immediate data.
According to the specs, if FORMAT present in INSERT query, the parser should skip all whitespace characters after FORMAT before first newline (including the first newline) or before first non-whitespace character, and treat all the remaining content as data stream.
So, in this example, the query contains immediate data, represented by single whitespace character: .
And this embedded data is correctly parsed as empty dataset in Values format.
But the problem is that this command also contains data from stdin.
This behaviour (silently ignore stdin) is not what user expects.
How to solve
Concatenate immediate data and stdin, similarly to how it is done in HTTP interface.
Activity