mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-10 01:25:21 +00:00
Backport #63930 to 24.3: Fix analyzer: there's turtles all the way down...
This commit is contained in:
parent
32ef90ed66
commit
e5a2bdfa04
@ -5604,9 +5604,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;
|
||||
/// Process possibly nested sub-selects
|
||||
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())
|
||||
|
@ -0,0 +1,4 @@
|
||||
0
|
||||
1
|
||||
0
|
||||
1
|
19
tests/queries/0_stateless/03155_in_nested_subselects.sql
Normal file
19
tests/queries/0_stateless/03155_in_nested_subselects.sql
Normal file
@ -0,0 +1,19 @@
|
||||
-- https://github.com/ClickHouse/ClickHouse/issues/63833
|
||||
SET allow_experimental_analyzer = 1;
|
||||
|
||||
create table Example (id Int32) engine = MergeTree ORDER BY id;
|
||||
INSERT INTO Example SELECT number AS id FROM numbers(2);
|
||||
|
||||
create table Null engine=Null as Example ;
|
||||
--create table Null engine=MergeTree order by id as Example ;
|
||||
|
||||
create materialized view Transform to Example as
|
||||
select * from Null
|
||||
join ( select * FROM Example
|
||||
WHERE id IN (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM (SELECT * FROM Null)))))
|
||||
) as old
|
||||
using id;
|
||||
|
||||
INSERT INTO Null SELECT number AS id FROM numbers(2);
|
||||
|
||||
select * from Example; -- should return 4 rows
|
Loading…
Reference in New Issue
Block a user