From 9a5552b5e65b7bdce1892ee91985a8841ef827b5 Mon Sep 17 00:00:00 2001 From: Dmitry Novik Date: Fri, 23 Aug 2024 14:56:03 +0200 Subject: [PATCH] Fix crash in IdentifierResolveScope::dump() --- src/Analyzer/Resolve/QueryAnalyzer.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Analyzer/Resolve/QueryAnalyzer.cpp b/src/Analyzer/Resolve/QueryAnalyzer.cpp index 35301310443..ecb358d90f0 100644 --- a/src/Analyzer/Resolve/QueryAnalyzer.cpp +++ b/src/Analyzer/Resolve/QueryAnalyzer.cpp @@ -4573,6 +4573,10 @@ void QueryAnalyzer::resolveTableFunction(QueryTreeNodePtr & table_function_node, if (parametrized_view_storage) { + /// Remove initial TableFunctionNode from the set. Otherwise it may lead to segfault + /// when IdentifierResolveScope::dump() is used. + scope.table_expressions_in_resolve_process.erase(table_function_node.get()); + auto fake_table_node = std::make_shared(parametrized_view_storage, scope_context); fake_table_node->setAlias(table_function_node->getAlias()); table_function_node = fake_table_node;