From b1f551d5bab27439e504d3258879ad43d87cf6c4 Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 15 Oct 2016 03:38:59 +0300 Subject: [PATCH] Client: Don't exit (only break) at first error in interactive mode when processing multiple queries in one command [#METR-19563]. --- dbms/src/Client/Client.cpp | 10 +++++++++- ...0_client_break_at_exception_in_batch_mode.reference | 1 + .../00380_client_break_at_exception_in_batch_mode.sh | 3 +++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.reference create mode 100755 dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.sh diff --git a/dbms/src/Client/Client.cpp b/dbms/src/Client/Client.cpp index ea1c53ef05e..60eec8a29e0 100644 --- a/dbms/src/Client/Client.cpp +++ b/dbms/src/Client/Client.cpp @@ -569,8 +569,16 @@ private: while (isWhitespace(*begin) || *begin == ';') ++begin; - if (!processSingleQuery(query, ast) || got_exception) + if (!processSingleQuery(query, ast)) return false; + + if (got_exception) + { + if (is_interactive) + break; + else + return false; + } } return true; diff --git a/dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.reference b/dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.reference new file mode 100644 index 00000000000..d00491fd7e5 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.reference @@ -0,0 +1 @@ +1 diff --git a/dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.sh b/dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.sh new file mode 100755 index 00000000000..ba788a688f8 --- /dev/null +++ b/dbms/tests/queries/0_stateless/00380_client_break_at_exception_in_batch_mode.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +clickhouse-client --multiquery --query="SELECT 1; SELECT xyz; SELECT 2;" 2> /dev/null;