Thread: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

pgsql: Refactor ChangeVarNodesExtended() using the custom callback

From
Alexander Korotkov
Date:
Refactor ChangeVarNodesExtended() using the custom callback

fc069a3a6319 implemented Self-Join Elimination (SJE) and put related logic
to ChangeVarNodes_walker().  This commit provides refactoring to remove the
SJE-related logic from ChangeVarNodes_walker() but adds a custom callback to
ChangeVarNodesExtended(), which has a chance to process a node before
ChangeVarNodes_walker().  Passing this callback to ChangeVarNodesExtended()
allows SJE-related node handling to be kept within the analyzejoins.c.

Reported-by: Richard Guo <guofenglinux@gmail.com>
Discussion: https://postgr.es/m/CAMbWs49PE3CvnV8vrQ0Dr%3DHqgZZmX0tdNbzVNJxqc8yg-8kDQQ%40mail.gmail.com
Author: Andrei Lepikhov <lepihov@gmail.com>
Author: Alexander Korotkov <aekorotkov@gmail.com>

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/250a718aadad68793e82103282247556a46a3cfc

Modified Files
--------------
src/backend/optimizer/plan/analyzejoins.c | 160 +++++++++++++++++++++++++++---
src/backend/rewrite/rewriteManip.c        | 138 ++++++--------------------
src/include/rewrite/rewriteManip.h        |  17 +++-
src/tools/pgindent/typedefs.list          |   1 +
4 files changed, 192 insertions(+), 124 deletions(-)


Alexander Korotkov <akorotkov@postgresql.org> writes:
> Refactor ChangeVarNodesExtended() using the custom callback

You are aware that we are in release freeze, no?

            regards, tom lane



Re: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

From
Alexander Korotkov
Date:
On Sat, May 3, 2025 at 10:34 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alexander Korotkov <akorotkov@postgresql.org> writes:
> > Refactor ChangeVarNodesExtended() using the custom callback
>
> You are aware that we are in release freeze, no?

I missed that.  Should I revert this commit now?

------
Regards,
Alexander Korotkov
Supabase



Alexander Korotkov <aekorotkov@gmail.com> writes:
> On Sat, May 3, 2025 at 10:34 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> You are aware that we are in release freeze, no?

> I missed that.  Should I revert this commit now?

Yes, I think so.  If you feel it's critical enough to go in on a
release weekend, you should ask pgsql-release@ for an exception.

            regards, tom lane



Re: pgsql: Refactor ChangeVarNodesExtended() using the custom callback

From
Alexander Korotkov
Date:
On Sat, May 3, 2025 at 11:06 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>
> Alexander Korotkov <aekorotkov@gmail.com> writes:
> > On Sat, May 3, 2025 at 10:34 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> >> You are aware that we are in release freeze, no?
>
> > I missed that.  Should I revert this commit now?
>
> Yes, I think so.  If you feel it's critical enough to go in on a
> release weekend, you should ask pgsql-release@ for an exception.

I don't think it's critical enough.  Reverted.
My apologies for breaking the rules.

------
Regards,
Alexander Korotkov
Supabase