Clickhouse: Broken multi-line paste in clickhouse-client

Created on 13 Nov 2019  路  10Comments  路  Source: ClickHouse/ClickHouse

I paste multiple lines with queries into clickhouse-client, each on its line:

DROP TABLE IF EXISTS userid_test;

SET use_index_for_in_with_subqueries = 1;

I expect them to run one after another -- it worked this way at least in 19.15, it works this way in bash, psql, etc.

What I get instead:

:) DROP TABLE IF EXISTS userid_test;

SET use_index_for_in_with_subqueries = 1;

Syntax error (Multi-statements are not allowed): failed at position 33 (end of query) (line 1, col 33):
bug comp-cli

Most helpful comment

@Tasselmi just run clickhouse-client with -m switch, and it start executing only after you finish the line with semicolon.

All 10 comments

I'm also hitting that last week.

Also you always need to press Enter after pasting some query.

One workaround is to run clickhouse with -nm parameters, but in that case exit command doesn't work (only Ctrl+C) :D

I think it's caused by https://github.com/ClickHouse/ClickHouse/pull/7492

@akuzm multi-statement pasting now requires -n after https://github.com/ClickHouse/ClickHouse/pull/7492 . (I wonder if that should be the default value)

Also you always need to press Enter after pasting some query.

@filimonov hmm, I favor the opposite, to validate (or do small changes to) the query that has been pasted instead of running it directly.

but in that case exit command doesn't work

Interesting! That deserves a fix.

I think we should not change the default behavior without a strong reason, even more so if we're changing it to something different from every other console client.

Fair enough. I've made it optional and default to false.

@amosbird If we will made it optional, it will not be used in 99.99% cases, and the code is non-trivial, so better to remove the code at all.

Ok, I've changed it to only enable bracketed-paste when multiquery is enabled and multiline is disabled. This should be less intrusive.

why not just learn from scala or spark-shell?

:paste to start copy code , and ctrl+d to start interpret....
just advice.

actually \ is not friendly , because I have to remove all the \ to run in tabix or other program.

so now how can I input multi-line sql code?
can you guys give me a example?
I have work to accomplish. thanks

@Tasselmi just run clickhouse-client with -m switch, and it start executing only after you finish the line with semicolon.

Was this page helpful?
0 / 5 - 0 ratings