Add query to the exception message in case of error during processing INSERT block on client

Since client process the INSERT block itself, and only after, send it
to the client, for example:

    clickhouse-client --stacktrace --input_format_null_as_default=1 --query="INSERT INTO FUNCTION null('k Int, v Tuple(Int,Int)') VALUES ()"
    Code: 62. DB::Exception: Cannot parse expression of type Int32 here: ): While executing ValuesBlockInputFormat: (in query: INSERT INTO FUNCTION null('k Int, v Tuple(Int,Int)') VALUES ()): data for INSERT was parsed from query. (SYNTAX_ERROR), Stack trace (when copying this message, always include the lines below):
This commit is contained in:
Azat Khuzhin 2021-09-11 15:48:59 +03:00
parent 648d561242
commit baac2e561c

View File

@ -2033,8 +2033,21 @@ private:
PullingAsyncPipelineExecutor executor(pipeline);
Block block;
while (executor.pull(block))
while (true)
{
try
{
if (!executor.pull(block))
{
break;
}
}
catch (Exception & e)
{
e.addMessage(fmt::format("(in query: {})", full_query));
throw;
}
/// Check if server send Log packet
receiveLogs();