diff --git a/programs/client/CMakeLists.txt b/programs/client/CMakeLists.txt index d212da59908..97616e9b69f 100644 --- a/programs/client/CMakeLists.txt +++ b/programs/client/CMakeLists.txt @@ -1,5 +1,6 @@ set (CLICKHOUSE_CLIENT_SOURCES Client.cpp + TestTags.cpp ) set (CLICKHOUSE_CLIENT_LINK diff --git a/programs/client/Client.cpp b/programs/client/Client.cpp index bb8105c1ea8..4b0e01ee10b 100644 --- a/programs/client/Client.cpp +++ b/programs/client/Client.cpp @@ -34,7 +34,7 @@ #include #include #include -#include "Columns/ColumnsNumber.h" +#include #include #include @@ -62,6 +62,7 @@ #include #include #include +#include "TestTags.h" #ifndef __clang__ #pragma GCC optimize("-fno-var-tracking-assignments") @@ -218,11 +219,16 @@ bool Client::executeMultiQuery(const String & all_queries_text) bool echo_query = echo_queries; + /// Test tags are started with "--" so they are interpreted as comments anyway. + /// But if the echo is enabled we have to remove the test tags from `all_queries_text` + /// because we don't want test tags to be echoed. + size_t test_tags_length = test_mode ? getTestTagsLength(all_queries_text) : 0; + /// Several queries separated by ';'. /// INSERT data is ended by the end of line, not ';'. /// An exception is VALUES format where we also support semicolon in /// addition to end of line. - const char * this_query_begin = all_queries_text.data(); + const char * this_query_begin = all_queries_text.data() + test_tags_length; const char * this_query_end; const char * all_queries_end = all_queries_text.data() + all_queries_text.size(); diff --git a/src/Client/ClientBase.cpp b/src/Client/ClientBase.cpp index c2bd3c7b4d0..1c81dbad638 100644 --- a/src/Client/ClientBase.cpp +++ b/src/Client/ClientBase.cpp @@ -800,9 +800,9 @@ void ClientBase::sendDataFrom(ReadBuffer & buf, Block & sample, const ColumnsDes break; } } - catch (Exception & e) + catch (Exception &) { - e.addMessage(fmt::format("(in query: {})", full_query)); + // e.addMessage(fmt::format("(in query: {})", full_query)); throw; } diff --git a/src/Client/LocalConnection.cpp b/src/Client/LocalConnection.cpp index d73040fc42f..b06825401b7 100644 --- a/src/Client/LocalConnection.cpp +++ b/src/Client/LocalConnection.cpp @@ -80,7 +80,7 @@ void LocalConnection::sendQuery( try { - state->io = executeQuery(state->query, query_context, false, state->stage, true); + state->io = executeQuery(state->query, query_context, false, state->stage); if (state->io.out) {