-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Analyzer: Expression can not be resolved from parent scope #71659
Copy link
Copy link
Closed
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release
Description
Company or project name
ClickHouse inc.
Describe what's wrong
Identifiers from the nested CTE are not evaluated properly.
https://fiddle.clickhouse.com/a62f1ed0-aa44-44af-888a-5b194d81b5a6
Does it reproduce on the most recent release?
Yes.
How to reproduce
CREATE TABLE test
(
a UInt64,
b UInt64,
)
ENGINE = MergeTree
ORDER BY tuple();
SET allow_experimental_analyzer=1;
WITH
(a > b) as cte,
query AS
(
SELECT count()
FROM test
WHERE cte
)
SELECT *
FROM query;
Error message and/or stacktrace
Received exception from server (version 24.10.1):
Code: 47. DB::Exception: Received from localhost:9000. DB::Exception: Unknown expression or function identifier `a` in scope WITH a > b AS cte, query AS (SELECT count() FROM test WHERE cte) SELECT * FROM query. (UNKNOWN_IDENTIFIER)
(query: WITH
(a > b) as cte,
query AS
(
SELECT count()
FROM test
WHERE cte
)
SELECT *
FROM query;)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
analyzerIssues and pull-requests related to new analyzerIssues and pull-requests related to new analyzerbugConfirmed user-visible misbehaviour in official releaseConfirmed user-visible misbehaviour in official release