From 653d962cdd04746e351604265ae2269ac5c81112 Mon Sep 17 00:00:00 2001 From: alesapin Date: Thu, 25 Feb 2021 17:43:58 +0300 Subject: [PATCH] Fix style and add low-level check --- src/Storages/MergeTree/MergeTreeData.h | 2 +- src/Storages/StorageView.cpp | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Storages/MergeTree/MergeTreeData.h b/src/Storages/MergeTree/MergeTreeData.h index 09cf017d220..f03f3f1dd8c 100644 --- a/src/Storages/MergeTree/MergeTreeData.h +++ b/src/Storages/MergeTree/MergeTreeData.h @@ -520,7 +520,7 @@ public: void checkAlterIsPossible(const AlterCommands & commands, const Settings & settings) const override; /// Checks if the Mutation can be performed. - /// (currenly no additional checks: always ok) + /// (currently no additional checks: always ok) void checkMutationIsPossible(const MutationCommands & commands, const Settings & settings) const override; /// Checks that partition name in all commands is valid diff --git a/src/Storages/StorageView.cpp b/src/Storages/StorageView.cpp index 38349ef8df9..22a1992d922 100644 --- a/src/Storages/StorageView.cpp +++ b/src/Storages/StorageView.cpp @@ -105,6 +105,9 @@ void StorageView::read( static ASTTableExpression * getFirstTableExpression(ASTSelectQuery & select_query) { + if (!select_query.tables() || select_query.tables()->children.empty()) + throw Exception("Logical error: no table expression in view select AST", ErrorCodes::LOGICAL_ERROR); + auto * select_element = select_query.tables()->children[0]->as(); if (!select_element->table_expression)