mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-23 08:02:02 +00:00
fixed segfault when creating materialized views. [#METR-11886]
This commit is contained in:
parent
bcc81b712d
commit
dfb21bcaff
@ -131,7 +131,13 @@ StoragePtr InterpreterCreateQuery::execute(bool assume_metadata_exists)
|
||||
/// Даже если в запросе был список столбцов, на всякий случай приведем его к стандартному виду (развернем Nested).
|
||||
ASTPtr new_columns = formatColumns(*columns);
|
||||
if (create.columns)
|
||||
*std::find(create.children.begin(), create.children.end(), create.columns) = new_columns;
|
||||
{
|
||||
auto it = std::find(create.children.begin(), create.children.end(), create.columns);
|
||||
if (it != create.children.end())
|
||||
*it = new_columns;
|
||||
else
|
||||
create.children.push_back(new_columns);
|
||||
}
|
||||
else
|
||||
create.children.push_back(new_columns);
|
||||
create.columns = new_columns;
|
||||
|
@ -39,6 +39,7 @@ StorageMaterializedView::StorageMaterializedView(const String & table_name_, con
|
||||
manual_create_query->database = database_name;
|
||||
manual_create_query->table = getInnerTableName();
|
||||
manual_create_query->columns = create.columns;
|
||||
manual_create_query->children.push_back(manual_create_query->columns);
|
||||
ASTPtr ast_create_query = manual_create_query;
|
||||
|
||||
/// Если не указан в запросе тип хранилища попробовать извлечь его из запроса Select.
|
||||
@ -52,6 +53,8 @@ StorageMaterializedView::StorageMaterializedView(const String & table_name_, con
|
||||
else
|
||||
manual_create_query->storage = create.inner_storage;
|
||||
|
||||
manual_create_query->children.push_back(manual_create_query->storage);
|
||||
|
||||
/// Выполним запрос.
|
||||
InterpreterCreateQuery create_interpreter(ast_create_query, context);
|
||||
data = create_interpreter.execute();
|
||||
|
Loading…
Reference in New Issue
Block a user