From 921000e9c5fdd834ed6d4720f9fa99b8305dd1fe Mon Sep 17 00:00:00 2001 From: Alexey Milovidov Date: Sat, 5 Mar 2016 00:26:36 +0300 Subject: [PATCH] dbms: fixed error [#METR-2944]. --- dbms/src/Interpreters/InterpreterCreateQuery.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/dbms/src/Interpreters/InterpreterCreateQuery.cpp b/dbms/src/Interpreters/InterpreterCreateQuery.cpp index 59929c3e888..846b5285a53 100644 --- a/dbms/src/Interpreters/InterpreterCreateQuery.cpp +++ b/dbms/src/Interpreters/InterpreterCreateQuery.cpp @@ -163,11 +163,12 @@ BlockIO InterpreterCreateQuery::executeImpl(bool assume_metadata_exists) create.children.push_back(new_columns); create.columns = new_columns; - auto ast_element_for_engine = [](const char * engine) + auto set_engine = [&](const char * engine) { + storage_name = engine; ASTFunction * func = new ASTFunction(); func->name = engine; - return func; + create.storage = func; }; /// Выбор нужного движка таблицы @@ -182,11 +183,11 @@ BlockIO InterpreterCreateQuery::executeImpl(bool assume_metadata_exists) create.storage = typeid_cast(*context.getCreateQuery(as_database_name, as_table_name)).storage; } else if (create.is_temporary) - create.storage = ast_element_for_engine("Memory"); + set_engine("Memory"); else if (create.is_view) - create.storage = ast_element_for_engine("View"); + set_engine("View"); else if (create.is_materialized_view) - create.storage = ast_element_for_engine("MaterializedView"); + set_engine("MaterializedView"); else throw Exception("Incorrect CREATE query: required ENGINE.", ErrorCodes::ENGINE_REQUIRED);