Skip to content

Commit e1969e2

Browse files
authored
Merge pull request #30288 from kssenii/fix-local-syntax-exception
Fix throwing syntax exception in clickhouse-local
2 parents 57f548d + 8b03595 commit e1969e2

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

programs/local/LocalServer.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
#include <IO/WriteBufferFromFileDescriptor.h>
3333
#include <IO/ReadHelpers.h>
3434
#include <IO/UseSSL.h>
35-
#include <Parsers/parseQuery.h>
3635
#include <Parsers/IAST.h>
3736
#include <base/ErrorHandlers.h>
3837
#include <Functions/registerFunctions.h>
@@ -128,10 +127,9 @@ bool LocalServer::executeMultiQuery(const String & all_queries_text)
128127
}
129128
case MultiQueryProcessingStage::PARSING_EXCEPTION:
130129
{
131-
this_query_end = find_first_symbols<'\n'>(this_query_end, all_queries_end);
132-
this_query_begin = this_query_end; /// It's expected syntax error, skip the line
133-
current_exception.reset();
134-
continue;
130+
if (current_exception)
131+
current_exception->rethrow();
132+
return true;
135133
}
136134
case MultiQueryProcessingStage::EXECUTE_QUERY:
137135
{
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
Code: 306
22
Code: 306
33
Code: 306
4+
Code: 306
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
OK
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/usr/bin/env bash
2+
3+
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
4+
# shellcheck source=../shell_config.sh
5+
. "$CURDIR"/../shell_config.sh
6+
7+
$CLICKHOUSE_LOCAL --query="SELECT number FROM system.numbers INTO OUTFILE test.native.zst FORMAT Native" 2>&1 | grep -q "Code: 62. DB::Exception: Syntax error: failed at position 48 ('test'): test.native.zst FORMAT Native. Expected string literal." && echo 'OK' || echo 'FAIL' ||:
8+

0 commit comments

Comments
 (0)