-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Logical Error: Column identifier __table1.a is already registered #85402
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 releasecomp-query-analyzerSemantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules).Semantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules).fuzzProblem found by one of the fuzzersProblem found by one of the fuzzers
Description
Describe the bug
According to the reproducible, the query should throw an unknown identifier error because in WHERE c = 1, there is no c identifier in scope. Happens since v25.4 with new analyzer enabled.
How to reproduce
Run Fiddle: https://fiddle.clickhouse.com/dd3d8f17-ef86-44c5-b026-8ca4c33ad765
Error message and/or stacktrace
Stack trace:
<Fatal> : Logical error: 'Column identifier __table1.a is already registered'.
<Fatal> : Stack trace (when copying this message, always include the lines below):
0. contrib/llvm-project/libcxx/include/__exception/exception.h:113: Poco::Exception::Exception(String const&, int) @ 0x0000000026ed6532
1. src/Common/Exception.cpp:119: DB::Exception::Exception(DB::Exception::MessageMasked&&, int, bool) @ 0x000000001423f929
2. src/Common/Exception.h:122: DB::Exception::Exception(String&&, int, String, bool) @ 0x000000000cee5f0e
3. src/Common/Exception.h:57: DB::Exception::Exception(PreformattedMessage&&, int) @ 0x000000000cee5691
4. src/Common/Exception.h:140: DB::Exception::Exception<String&>(int, FormatStringHelperImpl<std::type_identity<String&>::type>, String&) @ 0x000000000cefe676
5. src/Planner/PlannerContext.cpp:39: DB::GlobalPlannerContext::createColumnIdentifier(DB::NameAndTypePair const&, std::shared_ptr<DB::IQueryTreeNode> const&) @ 0x000000001a5bb8a7
6. src/Planner/PlannerContext.cpp:24: DB::GlobalPlannerContext::createColumnIdentifier(std::shared_ptr<DB::IQueryTreeNode> const&) @ 0x000000001a5bb5fb
7. src/Planner/CollectTableExpressionData.cpp:151: DB::InDepthQueryTreeVisitorWithContext<DB::(anonymous namespace)::CollectSourceColumnsVisitor>::visit(std::shared_ptr<DB::IQueryTreeNode>&) @ 0x000000001a8cd6c3
8. contrib/llvm-project/libcxx/include/vector:0: DB::InDepthQueryTreeVisitorWithContext<DB::(anonymous namespace)::CollectSourceColumnsVisitor>::visit(std::shared_ptr<DB::IQueryTreeNode>&) @ 0x000000001a8cdb91
9. contrib/llvm-project/libcxx/include/vector:0: DB::InDepthQueryTreeVisitorWithContext<DB::(anonymous namespace)::CollectSourceColumnsVisitor>::visit(std::shared_ptr<DB::IQueryTreeNode>&) @ 0x000000001a8cdb91
10. src/Planner/CollectTableExpressionData.cpp:398: DB::collectTableExpressionData(std::shared_ptr<DB::IQueryTreeNode>&, std::shared_ptr<DB::PlannerContext>&) @ 0x000000001a8cbfa3
11. src/Planner/Planner.cpp:1564: DB::Planner::buildPlanForQueryNode() @ 0x000000001a8e17b7
12. src/Planner/Planner.cpp:1402: DB::Planner::buildQueryPlanIfNeeded() @ 0x000000001a8df413
13. src/Planner/PlannerJoinTree.cpp:1322: DB::(anonymous namespace)::buildQueryPlanForTableExpression(std::shared_ptr<DB::IQueryTreeNode>, std::shared_ptr<DB::IQueryTreeNode> const&, DB::SelectQueryInfo const&, DB::SelectQueryOptions const&, std::shared_ptr<DB::PlannerContext>&, bool, bool) @ 0x000000001a901cd0
14. src/Planner/PlannerJoinTree.cpp:2528: DB::buildJoinTreeQueryPlan(std::shared_ptr<DB::IQueryTreeNode> const&, DB::SelectQueryInfo const&, DB::SelectQueryOptions&, std::unordered_set<String, std::hash<String>, std::equal_to<String>, std::allocator<String>> const&, std::shared_ptr<DB::PlannerContext>&) @ 0x000000001a8fbfb9
15. src/Planner/Planner.cpp:1631: DB::Planner::buildPlanForQueryNode() @ 0x000000001a8e27c7
16. src/Planner/Planner.cpp:1402: DB::Planner::buildQueryPlanIfNeeded() @ 0x000000001a8df413
17. src/Interpreters/InterpreterSelectQueryAnalyzer.cpp:269: DB::InterpreterSelectQueryAnalyzer::getQueryPlan() @ 0x000000001b21974d
18. src/Interpreters/executeQuery.cpp:1511: DB::executeQueryImpl(char const*, char const*, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum, std::unique_ptr<DB::ReadBuffer, std::default_delete<DB::ReadBuffer>>&, std::shared_ptr<DB::IAST>&, std::shared_ptr<DB::ImplicitTransactionControlExecutor>) @ 0x000000001b5033b9
19. src/Interpreters/executeQuery.cpp:1770: DB::executeQuery(String const&, std::shared_ptr<DB::Context>, DB::QueryFlags, DB::QueryProcessingStage::Enum) @ 0x000000001b4fee85
20. src/Server/TCPHandler.cpp:739: DB::TCPHandler::runImpl() @ 0x000000001ee1e84f
21. src/Server/TCPHandler.cpp:2740: DB::TCPHandler::run() @ 0x000000001ee386e4
22. base/poco/Net/src/TCPServerConnection.cpp:40: Poco::Net::TCPServerConnection::start() @ 0x0000000026f8cf07
23. base/poco/Net/src/TCPServerDispatcher.cpp:115: Poco::Net::TCPServerDispatcher::run() @ 0x0000000026f8d4e5
24. base/poco/Foundation/src/ThreadPool.cpp:205: Poco::PooledThread::run() @ 0x0000000026f2c6bf
25. base/poco/Foundation/src/Thread_POSIX.cpp:341: Poco::ThreadImpl::runnableEntry(void*) @ 0x0000000026f29d91
26. start_thread @ 0x00000000000a27f1
27. __GI___clone3 @ 0x0000000000133c9c
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 releasecomp-query-analyzerSemantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules).Semantic analysis + logical/physical planning + rewrites (Analyzer and Planner modules).fuzzProblem found by one of the fuzzersProblem found by one of the fuzzers