Break some tests

This commit is contained in:
kssenii 2021-09-09 13:25:25 +00:00
parent 1838a8672d
commit fa04b13175
3 changed files with 19 additions and 53 deletions

View File

@ -119,9 +119,6 @@ void Client::processError(const String & query) const
void Client::executeSignleQuery(const String & query_to_execute, ASTPtr parsed_query)
{
client_exception.reset();
server_exception.reset();
{
/// Temporarily apply query settings to context.
std::optional<Settings> old_settings;

View File

@ -86,41 +86,21 @@ void LocalServer::processError(const String & query) const
void LocalServer::executeSignleQuery(const String & query_to_execute, ASTPtr parsed_query)
{
/// To support previous behaviour of clickhouse-local do not reset first exception in case --ignore-error,
/// it needs to be thrown after multiquery is finished (test 00385). But I do not think it is ok to output only
/// first exception or whether we need to even rethrow it because there is --ignore-error.
if (!ignore_error)
const auto * insert = parsed_query->as<ASTInsertQuery>();
ASTPtr input_function;
if (insert && insert->select)
insert->tryFindInputFunction(input_function);
/// INSERT query for which data transfer is needed (not an INSERT SELECT or input()) is processed separately.
if (insert && (!insert->select || input_function) && !insert->watch)
{
server_exception.reset();
client_exception.reset();
}
try
{
const auto * insert = parsed_query->as<ASTInsertQuery>();
ASTPtr input_function;
if (insert && insert->select)
insert->tryFindInputFunction(input_function);
/// INSERT query for which data transfer is needed (not an INSERT SELECT or input()) is processed separately.
if (insert && (!insert->select || input_function) && !insert->watch)
{
if (input_function && insert->format.empty())
throw Exception("FORMAT must be specified for function input()", ErrorCodes::INVALID_USAGE_OF_INPUT);
processInsertQuery(query_to_execute, parsed_query);
}
else
processOrdinaryQuery(query_to_execute, parsed_query);
}
catch (...)
{
if (!ignore_error)
throw;
server_exception = std::make_unique<Exception>(getCurrentExceptionMessage(true), getCurrentExceptionCode());
have_error = true;
if (input_function && insert->format.empty())
throw Exception("FORMAT must be specified for function input()", ErrorCodes::INVALID_USAGE_OF_INPUT);
processInsertQuery(query_to_execute, parsed_query);
}
else
processOrdinaryQuery(query_to_execute, parsed_query);
}
@ -327,19 +307,6 @@ void LocalServer::tryInitPath()
}
static DatabasePtr createMemoryDatabaseIfNotExists(ContextPtr context, const String & database_name)
{
DatabasePtr system_database = DatabaseCatalog::instance().tryGetDatabase(database_name);
if (!system_database)
{
/// TODO: add attachTableDelayed into DatabaseMemory to speedup loading
system_database = std::make_shared<DatabaseMemory>(database_name, context);
DatabaseCatalog::instance().attachDatabase(database_name, system_database);
}
return system_database;
}
void LocalServer::cleanup()
{
connection.reset();
@ -497,10 +464,10 @@ try
{
runNonInteractive();
if (server_exception)
server_exception->rethrow();
if (client_exception)
client_exception->rethrow();
// if (server_exception)
// server_exception->rethrow();
// if (client_exception)
// client_exception->rethrow();
}
cleanup();

View File

@ -868,6 +868,8 @@ void ClientBase::processParsedSingleQuery(const String & full_query, const Strin
{
resetOutput();
have_error = false;
client_exception.reset();
server_exception.reset();
if (echo_query_ && *echo_query_)
{