process nested subqueries

This commit is contained in:
Yakov Olkhovskiy 2024-05-16 06:48:24 +00:00
parent 7aeeaabf3d
commit df90cb79b8

View File

@ -5615,9 +5615,13 @@ ProjectionNames QueryAnalyzer::resolveFunction(QueryTreeNodePtr & node, Identifi
/// Replace storage with values storage of insertion block
if (StoragePtr storage = scope.context->getViewSource())
{
if (auto * query_node = in_second_argument->as<QueryNode>())
QueryTreeNodePtr table_expression;
/// Don't even ask... there's turtles all the way down...
for (auto * query_node = in_second_argument->as<QueryNode>(); query_node; query_node = table_expression->as<QueryNode>())
table_expression = extractLeftTableExpression(query_node->getJoinTree());
if (table_expression)
{
auto table_expression = extractLeftTableExpression(query_node->getJoinTree());
if (auto * query_table_node = table_expression->as<TableNode>())
{
if (query_table_node->getStorageID().getFullNameNotQuoted() == storage->getStorageID().getFullNameNotQuoted())