fix empty table name

This commit is contained in:
Alexander Tokmakov 2020-01-09 19:01:44 +03:00
parent 54a75269cb
commit a1ff29b7e6
2 changed files with 8 additions and 3 deletions

View File

@ -622,8 +622,13 @@ void DDLWorker::processTask(DDLTask & task, const ZooKeeperPtr & zookeeper)
if (auto query_with_table = dynamic_cast<ASTQueryWithTableAndOutput *>(rewritten_ast.get()); query_with_table)
{
String database = query_with_table->database.empty() ? context.getCurrentDatabase() : query_with_table->database;
StoragePtr storage = context.tryGetTable(database, query_with_table->table);
StoragePtr storage;
if (!query_with_table->table.empty())
{
/// It's not CREATE DATABASE
String database = query_with_table->database.empty() ? context.getCurrentDatabase() : query_with_table->database;
storage = context.tryGetTable(database, query_with_table->table);
}
/// For some reason we check consistency of cluster definition only
/// in case of ALTER query, but not in case of CREATE/DROP etc.

View File

@ -50,7 +50,7 @@ struct StorageID
{
assertNotEmpty();
return (database_name.empty() ? "" : backQuoteIfNeed(database_name) + ".") + backQuoteIfNeed(table_name)
+ (hasUUID() ? "" : " (UUID " + toString(uuid) + ")");
+ (hasUUID() ? " (UUID " + toString(uuid) + ")" : "");
}
bool empty() const