Re: Some problems regarding the self-join elimination code
Andrei Lepikhov <lepihov@gmail.com>
From: Andrei Lepikhov <lepihov@gmail.com>
To: Alexander Korotkov <aekorotkov@gmail.com>
Cc: Richard Guo <guofenglinux@gmail.com>,
Dean Rasheed <dean.a.rasheed@gmail.com>, Tom Lane <tgl@sss.pgh.pa.us>,
Pg Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-04-30T13:34:28Z
Lists: pgsql-hackers
On 4/30/25 13:22, Alexander Korotkov wrote: >> Thank you, Andrei. I've put it all together. >> 0001 Fixes material bugs in ChangeVarNodes_walker() including regression test >> 0002 Puts back comments which got accidentally removed >> 0003 Refactors ChangeVarNodesExtended() with custom user-defined callback > I've revised the remaining refactoring patch. I've made a callback an > additional callback, but not the replacement to the walker. It looks > better for me now. Also, I've written some comments and the commit > message. Any thoughts? It seems quite elegant to me. I have not precisely examined the part with the RestrictInfo replacement logic - I guess you just copied it - I reviewed the rest of the patch. Generally, it looks good, but let me be a little picky. 1. Looking into the callback-related code, I suggest changing the name of ChangeVarNodes_callback to something less general and more specific - like replace_relid_callback. My variant doesn't seem the best, but general-purposed name seems worse. 2. This callback doesn't modify query replacement logic's behaviour- it only affects expressions. It makes sense to write about that in the description of the ChangeVarNodesExtended. 3. Should the ChangeVarNodesWalkExpression function return the walker's returning value? -- regards, Andrei Lepikhov
Commits
-
Refactor ChangeVarNodesExtended() using the custom callback
- ab42d643c145 18.0 landed
- 250a718aadad 18.0 landed
-
Fixes for ChangeVarNodes_walker()
- 2260c7f6d90e 18.0 landed
-
Restore comments in ChangeVarNodesExtended()
- 73e736137616 18.0 landed