Re: Some problems regarding the self-join elimination code

From: Alexander Korotkov <aekorotkov(at)gmail(dot)com>
To: Andrei Lepikhov <lepihov(at)gmail(dot)com>
Cc: Richard Guo <guofenglinux(at)gmail(dot)com>, Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Some problems regarding the self-join elimination code
Date: 2025-05-01 12:11:41
Message-ID: CAPpHfdvUHRfFdO4CbyOmYSQnURGJ90ofTeDpgx7XmOqn8UOy1w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi, Andrei!

Thank you for your review!

On Wed, Apr 30, 2025 at 4:34 PM Andrei Lepikhov <lepihov(at)gmail(dot)com> wrote:

> 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.
>

I didn't have any better ideas and picked the name you proposed. Then I
renamed ChangeVarNodes_callback_type to just ChangeVarNodes_callback. Now
it seems consitent with other type names like ChangeVarNodes_context (which
is not ChangeVarNodes_context_type).

> 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.
>

I've added a couple sentences to ChangeVarNodesExtended().

3. Should the ChangeVarNodesWalkExpression function return the walker's
> returning value?
>

Done.

------
Regards,
Alexander Korotkov
Supabase

Attachment Content-Type Size
v5-0001-Refactor-ChangeVarNodesExtended-using-the-custom-.patch application/octet-stream 19.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2025-05-01 12:14:50 Re: Issue attaching a table to a partitioned table with an auto-referenced foreign key
Previous Message Peter Eisentraut 2025-05-01 11:50:37 Re: RFC: Additional Directory for Extensions