Re: Making Vars outer-join aware

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Pg Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, "Finnerty, Jim" <jfinnert(at)amazon(dot)com>
Subject: Re: Making Vars outer-join aware
Date: 2022-11-10 10:13:54
Message-ID: CAMbWs498WbksxYZLf6j7FxmsBA2-2eFXnEk+Y7JC735GraHR+g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Aug 25, 2022 at 6:27 PM Richard Guo <guofenglinux(at)gmail(dot)com> wrote:

> I'm not sure if I understand it correctly. If we are given the first
> order from the parser, the SpecialJoinInfo for the B/C join would have
> min_lefthand as containing both B and the A/B join. And this
> SpecialJoinInfo would make the B/C join be invalid, which is not what we
> want.
>

Now I see how this works from v6 patch. Once we notice identity 3
applies, we will remove the lower OJ's ojrelid from the min_lefthand or
min_righthand so that the commutation is allowed. So in this case, the
A/B join would be removed from B/C join's min_lefthand when we build the
SpecialJoinInfo for B/C join, and that makes the B/C join to be legal.

BTW, inner_join_rels can contain base Relids and OJ Relids. Maybe we
can revise the comments a bit for it atop deconstruct_recurse and
make_outerjoininfo. The same for the comments of qualscope, ojscope and
outerjoin_nonnullable atop distribute_qual_to_rels.

The README mentions restriction_is_computable_at(), I think it should be
clause_is_computable_at().

Thanks
Richard

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-11-10 10:26:35 Re: Printing backtrace of postgres processes
Previous Message Juan José Santamaría Flecha 2022-11-10 10:08:32 Re: WIN32 pg_import_system_collations