Merge pull request #8323 from ClickHouse/minor-improvements-backquote

Added quoting of db and table names where appropriate
This commit is contained in:
alexey-milovidov 2019-12-20 22:14:35 +03:00 committed by GitHub
commit 980cf16873
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 5 deletions

View File

@ -2,6 +2,7 @@
#include <Core/Types.h> #include <Core/Types.h>
#include <Common/CpuId.h> #include <Common/CpuId.h>
#include <Common/quoteString.h>
#include <common/getMemoryAmount.h> #include <common/getMemoryAmount.h>
#include <DataStreams/copyData.h> #include <DataStreams/copyData.h>
#include <DataStreams/NullBlockOutputStream.h> #include <DataStreams/NullBlockOutputStream.h>
@ -142,7 +143,7 @@ bool PerformanceTest::checkPreconditions() const
if (!exist) if (!exist)
{ {
LOG_WARNING(log, "Table " << table_to_check << " doesn't exist"); LOG_WARNING(log, "Table " << backQuote(table_to_check) << " doesn't exist");
return false; return false;
} }
} }

View File

@ -110,7 +110,7 @@ void TCPHandler::runImpl()
{ {
if (!connection_context.isDatabaseExist(default_database)) if (!connection_context.isDatabaseExist(default_database))
{ {
Exception e("Database " + default_database + " doesn't exist", ErrorCodes::UNKNOWN_DATABASE); Exception e("Database " + backQuote(default_database) + " doesn't exist", ErrorCodes::UNKNOWN_DATABASE);
LOG_ERROR(log, "Code: " << e.code() << ", e.displayText() = " << e.displayText() LOG_ERROR(log, "Code: " << e.code() << ", e.displayText() = " << e.displayText()
<< ", Stack trace:\n\n" << e.getStackTrace().toString()); << ", Stack trace:\n\n" << e.getStackTrace().toString());
sendException(e, connection_context.getSettingsRef().calculate_text_stack_trace); sendException(e, connection_context.getSettingsRef().calculate_text_stack_trace);

View File

@ -153,7 +153,7 @@ StoragePtr DatabaseWithOwnTablesBase::detachTable(const String & table_name)
auto it = tables.find(table_name); auto it = tables.find(table_name);
if (it == tables.end()) if (it == tables.end())
throw Exception("Table " + name + "." + table_name + " doesn't exist.", ErrorCodes::UNKNOWN_TABLE); throw Exception("Table " + backQuote(name) + "." + backQuote(table_name) + " doesn't exist.", ErrorCodes::UNKNOWN_TABLE);
res = it->second; res = it->second;
tables.erase(it); tables.erase(it);
} }

View File

@ -142,7 +142,7 @@ LibraryDictionarySource::LibraryDictionarySource(
if (!Poco::File(path).exists()) if (!Poco::File(path).exists())
throw Exception( throw Exception(
"LibraryDictionarySource: Can't load lib " + toString() + ": " + Poco::File(path).path() + " - File doesn't exist", "LibraryDictionarySource: Can't load library " + Poco::File(path).path() + ": file doesn't exist",
ErrorCodes::FILE_DOESNT_EXIST); ErrorCodes::FILE_DOESNT_EXIST);
description.init(sample_block); description.init(sample_block);

View File

@ -30,6 +30,7 @@
#include <Common/setThreadName.h> #include <Common/setThreadName.h>
#include <Common/typeid_cast.h> #include <Common/typeid_cast.h>
#include <common/logger_useful.h> #include <common/logger_useful.h>
#include <Common/quoteString.h>
namespace DB namespace DB
@ -364,7 +365,7 @@ bool StorageKafka::streamToViews()
{ {
auto table = global_context.getTable(database_name, table_name); auto table = global_context.getTable(database_name, table_name);
if (!table) if (!table)
throw Exception("Engine table " + database_name + "." + table_name + " doesn't exist.", ErrorCodes::LOGICAL_ERROR); throw Exception("Engine table " + backQuote(database_name) + "." + backQuote(table_name) + " doesn't exist.", ErrorCodes::LOGICAL_ERROR);
// Create an INSERT query for streaming data // Create an INSERT query for streaming data
auto insert = std::make_shared<ASTInsertQuery>(); auto insert = std::make_shared<ASTInsertQuery>();