mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-21 23:21:59 +00:00
ISSUES-117 support drop temporary table
This commit is contained in:
parent
bfe48f1255
commit
19e7c291db
@ -46,7 +46,7 @@ BlockIO InterpreterDropQuery::execute()
|
||||
}
|
||||
|
||||
/// Drop temporary table.
|
||||
if (drop.database.empty())
|
||||
if (drop.temporary)
|
||||
{
|
||||
StoragePtr table = (context.hasSessionContext() ? context.getSessionContext() : context).tryRemoveExternalTable(drop.table);
|
||||
if (table)
|
||||
|
@ -15,6 +15,7 @@ class ASTDropQuery : public ASTQueryWithOutput, public ASTQueryWithOnCluster
|
||||
public:
|
||||
bool detach{false}; /// DETACH query, not DROP.
|
||||
bool if_exists{false};
|
||||
bool temporary{false};
|
||||
String database;
|
||||
String table;
|
||||
|
||||
|
@ -17,6 +17,7 @@ bool ParserDropQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
|
||||
ParserKeyword s_drop("DROP");
|
||||
ParserKeyword s_detach("DETACH");
|
||||
ParserKeyword s_temporary("TEMPORARY");
|
||||
ParserKeyword s_table("TABLE");
|
||||
ParserKeyword s_database("DATABASE");
|
||||
ParserToken s_dot(TokenType::Dot);
|
||||
@ -28,6 +29,7 @@ bool ParserDropQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
String cluster_str;
|
||||
bool detach = false;
|
||||
bool if_exists = false;
|
||||
bool temporary = false;
|
||||
|
||||
if (!s_drop.ignore(pos, expected))
|
||||
{
|
||||
@ -53,6 +55,9 @@ bool ParserDropQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s_temporary.ignore(pos, expected))
|
||||
temporary = true;
|
||||
|
||||
if (!s_table.ignore(pos, expected))
|
||||
return false;
|
||||
|
||||
@ -81,6 +86,7 @@ bool ParserDropQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expected)
|
||||
|
||||
query->detach = detach;
|
||||
query->if_exists = if_exists;
|
||||
query->temporary = temporary;
|
||||
if (database)
|
||||
query->database = typeid_cast<ASTIdentifier &>(*database).name;
|
||||
if (table)
|
||||
|
Loading…
Reference in New Issue
Block a user