Re: BUG #19435: Error: "No relation entry for relid 2" Triggered by Complex Join with Self-Referencing Tables
Andrei Lepikhov <lepihov@gmail.com>
From: Andrei Lepikhov <lepihov@gmail.com>
To: Alexander Korotkov <aekorotkov@gmail.com>,
Tender Wang <tndrwang@gmail.com>
Cc: Kirill Reshke <reshkekirill@gmail.com>,
Fujii Masao <masao.fujii@gmail.com>, ammmkilo@163.com,
pgsql-bugs@lists.postgresql.org
Date: 2026-03-18T12:18:27Z
Lists: pgsql-bugs
Attachments
- fix.diff (text/plain) patch
On 18/3/26 09:40, Alexander Korotkov wrote: > What about being more generic and call ChangeVarNodes_walker() for the > node in ChangeVarNodesWalkExpression()? It also works with out case > and avoids code duplication. I’ve reached the same conclusion. We lost a possible case when the RestrictInfo→clause contains a bare Var that isn’t pushed into either the left or right subtree. I think we can fix this by replacing the expression walker with ChangeVarNodes_walker(). What is the reason for the second change? Tender, can you show us how to reproduce the issue so we can support your update to restrict_infos_logically_equal? If we include it, we should add a test. -- regards, Andrei Lepikhov, pgEdge
Commits
-
Further improve commentary about ChangeVarNodesWalkExpression()
- 6888658516a2 19 (unreleased) landed
- 8c73ab9da9f1 18.4 landed
-
Improve commentary about ChangeVarNodesWalkExpression().
- a0e0b3cc685a 18.4 landed
- 360dd6f7b4c5 19 (unreleased) landed
-
Fix self-join removal to update bare Var references in join clauses
- e8b9d6497469 18.4 landed
- 07b7a964d368 19 (unreleased) landed
-
Implement Self-Join Elimination
- fc069a3a6319 18.0 cited