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 CAMbWs48KGwkgAE0jXZEfuAoomwCyPu6nNt2MxLG1y2gzXVDjmA@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)
List pgsql-hackers

On Wed, Jun 28, 2023 at 6:28 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
For a real fix, I'm inclined to extend the loop that calculates
param_source_rels (in add_paths_to_joinrel) so that it also tracks
a set of incompatible relids that *must not* be present in the
parameterization of a proposed path.  This would basically include
OJ relids of OJs that partially overlap the target joinrel; maybe
we should also include the min RHS of such OJs.  Then we could
check that in try_nestloop_path.  I've not tried to code this yet.

I went ahead and drafted a patch based on this idea.  A little
differences include

* You mentioned that the incompatible relids might need to also include
the min_righthand of the OJs that are part of the target joinrel.  It
seems to me that we may need to also include the min_lefthand of such
OJs, because the parameterization of any proposed join path for the
target joinrel should not overlap anything in an OJ if the OJ is part of
this joinrel.

* I think we need to check the incompatible relids also in
try_hashjoin_path and try_mergejoin_path besides try_nestloop_path.

Thanks
Richard
Attachment

pgsql-hackers by date:

Previous
From: "Drouvot, Bertrand"
Date:
Subject: Re: Synchronizing slots from primary to standby
Next
From: Michael Paquier
Date:
Subject: Re: Another incorrect comment for pg_stat_statements