mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-12-12 17:32:32 +00:00
support rename table without keyword TABLE
This commit is contained in:
parent
55fc3fe8ab
commit
8f82d64129
@ -11,6 +11,7 @@ namespace DB
|
|||||||
|
|
||||||
bool ParserRenameQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
bool ParserRenameQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||||
{
|
{
|
||||||
|
ParserKeyword s_rename("RENAME");
|
||||||
ParserKeyword s_rename_table("RENAME TABLE");
|
ParserKeyword s_rename_table("RENAME TABLE");
|
||||||
ParserKeyword s_exchange_tables("EXCHANGE TABLES");
|
ParserKeyword s_exchange_tables("EXCHANGE TABLES");
|
||||||
ParserKeyword s_rename_dictionary("RENAME DICTIONARY");
|
ParserKeyword s_rename_dictionary("RENAME DICTIONARY");
|
||||||
@ -24,18 +25,7 @@ bool ParserRenameQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
bool exchange = false;
|
bool exchange = false;
|
||||||
bool dictionary = false;
|
bool dictionary = false;
|
||||||
|
|
||||||
if (s_rename_table.ignore(pos, expected))
|
if (s_rename_database.ignore(pos, expected))
|
||||||
;
|
|
||||||
else if (s_exchange_tables.ignore(pos, 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;
|
ASTPtr from_db;
|
||||||
ASTPtr to_db;
|
ASTPtr to_db;
|
||||||
@ -67,6 +57,19 @@ bool ParserRenameQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
|||||||
node = query;
|
node = query;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else if(s_rename_table.ignore(pos, expected))
|
||||||
|
;
|
||||||
|
else if (s_exchange_tables.ignore(pos, 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.ignore(pos, expected))
|
||||||
|
;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
r1
|
||||||
|
r2
|
||||||
|
r3
|
@ -0,0 +1,14 @@
|
|||||||
|
DROP DATABASE IF EXISTS rename_db;
|
||||||
|
CREATE DATABASE rename_db;
|
||||||
|
|
||||||
|
CREATE TABLE rename_db.r1 (name String) Engine=Memory();
|
||||||
|
SHOW TABLES FROM rename_db;
|
||||||
|
|
||||||
|
RENAME TABLE rename_db.r1 TO rename_db.r2;
|
||||||
|
SHOW TABLES FROM rename_db;
|
||||||
|
|
||||||
|
RENAME rename_db.r2 TO rename_db.r3;
|
||||||
|
SHOW TABLES FROM rename_db;
|
||||||
|
|
||||||
|
DROP DATABASE rename_db;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user