On Wed, Jun 28, 2023 at 6:28 AM Tom Lane <t...@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
v1-0001-Draft-Avoid-invalid-parameterized-path-for-joinrel.patch
Description: Binary data