mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
Added EXCHANGE DICTIONARIES query support
This commit is contained in:
parent
71bccfdea1
commit
f37599112a
@ -159,8 +159,6 @@ void DatabaseAtomic::renameTable(ContextPtr local_context, const String & table_
|
||||
return;
|
||||
}
|
||||
|
||||
if (exchange && dictionary)
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "Cannot exchange dictionaries");
|
||||
if (exchange && !supportsRenameat2())
|
||||
throw Exception(ErrorCodes::NOT_IMPLEMENTED, "RENAME EXCHANGE is not supported");
|
||||
|
||||
@ -230,9 +228,15 @@ void DatabaseAtomic::renameTable(ContextPtr local_context, const String & table_
|
||||
|
||||
StoragePtr table = getTableUnlocked(table_name, db_lock);
|
||||
|
||||
if (dictionary != table->isDictionary())
|
||||
if (table->isDictionary() && !dictionary)
|
||||
{
|
||||
if (exchange)
|
||||
throw Exception(ErrorCodes::INCORRECT_QUERY,
|
||||
"Use EXCHANGE DICTIONARIES for dictionaries and EXCAHNGE TABLES for tables.");
|
||||
else
|
||||
throw Exception(ErrorCodes::INCORRECT_QUERY,
|
||||
"Use RENAME DICTIONARY for dictionaries and RENAME TABLE for tables.");
|
||||
}
|
||||
|
||||
table->checkTableCanBeRenamed();
|
||||
assert_can_move_mat_view(table);
|
||||
|
@ -42,6 +42,7 @@ bool ParserRenameQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
ParserKeyword s_rename_table("RENAME TABLE");
|
||||
ParserKeyword s_exchange_tables("EXCHANGE TABLES");
|
||||
ParserKeyword s_rename_dictionary("RENAME DICTIONARY");
|
||||
ParserKeyword s_exchange_dictionaries("EXCHANGE DICTIONARIES");
|
||||
ParserKeyword s_rename_database("RENAME DATABASE");
|
||||
ParserKeyword s_to("TO");
|
||||
ParserKeyword s_and("AND");
|
||||
@ -56,6 +57,11 @@ bool ParserRenameQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
exchange = true;
|
||||
else if (s_rename_dictionary.ignore(pos, expected))
|
||||
dictionary = true;
|
||||
else if (s_exchange_dictionaries.ignore(pos, expected))
|
||||
{
|
||||
exchange = true;
|
||||
dictionary = true;
|
||||
}
|
||||
else if (s_rename_database.ignore(pos, expected))
|
||||
{
|
||||
ASTPtr from_db;
|
||||
|
Loading…
Reference in New Issue
Block a user