| 95 | } |
| 96 | |
| 97 | StoragePtr TableFunctionViewIfPermitted::executeImpl( |
| 98 | const ASTPtr & /* ast_function */, ContextPtr context, const std::string & table_name, ColumnsDescription /* cached_columns */, bool is_insert_query) const |
| 99 | { |
| 100 | StoragePtr storage; |
| 101 | auto columns = getActualTableStructure(context, is_insert_query); |
| 102 | |
| 103 | if (isPermitted(context, columns)) |
| 104 | { |
| 105 | storage = std::make_shared<StorageView>(StorageID(getDatabaseName(), table_name), create, columns, ""); |
| 106 | } |
| 107 | else |
| 108 | { |
| 109 | storage = else_table_function->execute(else_ast, context, table_name); |
| 110 | } |
| 111 | |
| 112 | storage->startup(); |
| 113 | return storage; |
| 114 | } |
| 115 | |
| 116 | bool TableFunctionViewIfPermitted::isPermitted(const ContextPtr & context, const ColumnsDescription & else_columns) const |
| 117 | { |