mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-17 13:13:36 +00:00
Add parameters to more CREATE queries
This commit is contained in:
parent
fa6cf6685e
commit
bdbfa24048
@ -423,7 +423,7 @@ bool ParserCreateTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expe
|
||||
ParserKeyword s_temporary("TEMPORARY");
|
||||
ParserKeyword s_table("TABLE");
|
||||
ParserKeyword s_if_not_exists("IF NOT EXISTS");
|
||||
ParserCompoundIdentifier table_name_p(true);
|
||||
ParserCompoundIdentifier table_name_p(true, true);
|
||||
ParserKeyword s_from("FROM");
|
||||
ParserKeyword s_on("ON");
|
||||
ParserKeyword s_as("AS");
|
||||
@ -492,7 +492,7 @@ bool ParserCreateTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expe
|
||||
return false;
|
||||
}
|
||||
|
||||
auto table_id = table->as<ASTTableIdentifier>()->getTableId();
|
||||
auto table_id = table->as<ASTTableIdentifier>();
|
||||
|
||||
// Shortcut for ATTACH a previously detached table
|
||||
bool short_attach = attach && !from_path;
|
||||
@ -505,9 +505,14 @@ bool ParserCreateTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expe
|
||||
query->if_not_exists = if_not_exists;
|
||||
query->cluster = cluster_str;
|
||||
|
||||
query->setDatabase(table_id.database_name);
|
||||
query->setTable(table_id.table_name);
|
||||
query->uuid = table_id.uuid;
|
||||
query->database = table_id->getDatabase();
|
||||
query->table = table_id->getTable();
|
||||
query->uuid = table_id->uuid;
|
||||
|
||||
if (query->database)
|
||||
query->children.push_back(query->database);
|
||||
if (query->table)
|
||||
query->children.push_back(query->table);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -582,11 +587,16 @@ bool ParserCreateTableQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expe
|
||||
query->if_not_exists = if_not_exists;
|
||||
query->temporary = is_temporary;
|
||||
|
||||
query->setDatabase(table_id.database_name);
|
||||
query->setTable(table_id.table_name);
|
||||
query->uuid = table_id.uuid;
|
||||
query->database = table_id->getDatabase();
|
||||
query->table = table_id->getTable();
|
||||
query->uuid = table_id->uuid;
|
||||
query->cluster = cluster_str;
|
||||
|
||||
if (query->database)
|
||||
query->children.push_back(query->database);
|
||||
if (query->table)
|
||||
query->children.push_back(query->table);
|
||||
|
||||
query->set(query->columns_list, columns_list);
|
||||
query->set(query->storage, storage);
|
||||
|
||||
@ -614,7 +624,7 @@ bool ParserCreateLiveViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & e
|
||||
ParserKeyword s_create("CREATE");
|
||||
ParserKeyword s_attach("ATTACH");
|
||||
ParserKeyword s_if_not_exists("IF NOT EXISTS");
|
||||
ParserCompoundIdentifier table_name_p(true);
|
||||
ParserCompoundIdentifier table_name_p(true, true);
|
||||
ParserKeyword s_as("AS");
|
||||
ParserKeyword s_view("VIEW");
|
||||
ParserKeyword s_live("LIVE");
|
||||
@ -729,12 +739,17 @@ bool ParserCreateLiveViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & e
|
||||
query->if_not_exists = if_not_exists;
|
||||
query->is_live_view = true;
|
||||
|
||||
auto table_id = table->as<ASTTableIdentifier>()->getTableId();
|
||||
query->setDatabase(table_id.database_name);
|
||||
query->setTable(table_id.table_name);
|
||||
query->uuid = table_id.uuid;
|
||||
auto table_id = table->as<ASTTableIdentifier>();
|
||||
query->database = table_id->getDatabase();
|
||||
query->table = table_id->getTable();
|
||||
query->uuid = table_id->uuid;
|
||||
query->cluster = cluster_str;
|
||||
|
||||
if (query->database)
|
||||
query->children.push_back(query->database);
|
||||
if (query->table)
|
||||
query->children.push_back(query->table);
|
||||
|
||||
if (to_table)
|
||||
query->to_table_id = to_table->as<ASTTableIdentifier>()->getTableId();
|
||||
|
||||
@ -828,7 +843,7 @@ bool ParserCreateViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
ParserKeyword s_create("CREATE");
|
||||
ParserKeyword s_attach("ATTACH");
|
||||
ParserKeyword s_if_not_exists("IF NOT EXISTS");
|
||||
ParserCompoundIdentifier table_name_p(true);
|
||||
ParserCompoundIdentifier table_name_p(true, true);
|
||||
ParserKeyword s_as("AS");
|
||||
ParserKeyword s_view("VIEW");
|
||||
ParserKeyword s_materialized("MATERIALIZED");
|
||||
@ -948,12 +963,17 @@ bool ParserCreateViewQuery::parseImpl(Pos & pos, ASTPtr & node, Expected & expec
|
||||
query->is_populate = is_populate;
|
||||
query->replace_view = replace_view;
|
||||
|
||||
auto table_id = table->as<ASTTableIdentifier>()->getTableId();
|
||||
query->setDatabase(table_id.database_name);
|
||||
query->setTable(table_id.table_name);
|
||||
query->uuid = table_id.uuid;
|
||||
auto table_id = table->as<ASTTableIdentifier>();
|
||||
query->database = table_id->getDatabase();
|
||||
query->table = table_id->getTable();
|
||||
query->uuid = table_id->uuid;
|
||||
query->cluster = cluster_str;
|
||||
|
||||
if (query->database)
|
||||
query->children.push_back(query->database);
|
||||
if (query->table)
|
||||
query->children.push_back(query->table);
|
||||
|
||||
if (to_table)
|
||||
query->to_table_id = to_table->as<ASTTableIdentifier>()->getTableId();
|
||||
if (to_inner_uuid)
|
||||
@ -979,7 +999,7 @@ bool ParserCreateDictionaryQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, E
|
||||
ParserKeyword s_dictionary("DICTIONARY");
|
||||
ParserKeyword s_if_not_exists("IF NOT EXISTS");
|
||||
ParserKeyword s_on("ON");
|
||||
ParserCompoundIdentifier dict_name_p(true);
|
||||
ParserCompoundIdentifier dict_name_p(true, true);
|
||||
ParserToken s_left_paren(TokenType::OpeningRoundBracket);
|
||||
ParserToken s_right_paren(TokenType::ClosingRoundBracket);
|
||||
ParserToken s_dot(TokenType::Dot);
|
||||
@ -1049,10 +1069,15 @@ bool ParserCreateDictionaryQuery::parseImpl(IParser::Pos & pos, ASTPtr & node, E
|
||||
query->create_or_replace = or_replace;
|
||||
query->replace_table = replace;
|
||||
|
||||
auto dict_id = name->as<ASTTableIdentifier>()->getTableId();
|
||||
query->setDatabase(dict_id.database_name);
|
||||
query->setTable(dict_id.table_name);
|
||||
query->uuid = dict_id.uuid;
|
||||
auto dict_id = name->as<ASTTableIdentifier>();
|
||||
query->database = dict_id->getDatabase();
|
||||
query->table = dict_id->getTable();
|
||||
query->uuid = dict_id->uuid;
|
||||
|
||||
if (query->database)
|
||||
query->children.push_back(query->database);
|
||||
if (query->table)
|
||||
query->children.push_back(query->table);
|
||||
|
||||
query->if_not_exists = if_not_exists;
|
||||
query->set(query->dictionary_attributes_list, attributes);
|
||||
|
Loading…
Reference in New Issue
Block a user