On Thu, Aug 25, 2022 at 6:27 PM Richard Guo <guofengli...@gmail.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