Re: Assert !bms_overlap(joinrel->relids, required_outer) - Mailing list pgsql-hackers

From Richard Guo
Subject Re: Assert !bms_overlap(joinrel->relids, required_outer)
Date
Msg-id CAMbWs4_UoVcCwkVMfi9TjSC=o5U6BRHUNZiVhrvSbDfU2HaeDA@mail.gmail.com
Whole thread Raw
In response to Re: Assert !bms_overlap(joinrel->relids, required_outer)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Assert !bms_overlap(joinrel->relids, required_outer)  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers

On Wed, Jun 28, 2023 at 10:09 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Those cases will go through calc_non_nestloop_required_outer
which has

        /* neither path can require rels from the other */
        Assert(!bms_overlap(outer_paramrels, inner_path->parent->relids));
        Assert(!bms_overlap(inner_paramrels, outer_path->parent->relids));

Looking at these two assertions it occurred to me that shouldn't we
check against top_parent_relids for an otherrel since paths are
parameterized by top-level parents?  We do that in try_nestloop_path.

    /* neither path can require rels from the other */
-   Assert(!bms_overlap(outer_paramrels, inner_path->parent->relids));
-   Assert(!bms_overlap(inner_paramrels, outer_path->parent->relids));
+   Assert(!bms_overlap(outer_paramrels,
+                       inner_path->parent->top_parent_relids ?
+                       inner_path->parent->top_parent_relids :
+                       inner_path->parent->relids));
+   Assert(!bms_overlap(inner_paramrels,
+                       outer_path->parent->top_parent_relids ?
+                       outer_path->parent->top_parent_relids :
+                       outer_path->parent->relids));

This is not related to the issue being discussed here.  Maybe it should
be a separate issue.

Thanks
Richard

pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: ReadRecentBuffer() doesn't scale well
Next
From: John Morris
Date:
Subject: Unified File API