Re: Assert !bms_overlap(joinrel->relids, required_outer)

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Assert !bms_overlap(joinrel->relids, required_outer)
Date: 2023-06-28 06:51:54
Message-ID: CAMbWs48KGwkgAE0jXZEfuAoomwCyPu6nNt2MxLG1y2gzXVDjmA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 28, 2023 at 6:28 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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 Content-Type Size
v1-0001-Draft-Avoid-invalid-parameterized-path-for-joinrel.patch application/octet-stream 8.1 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2023-06-28 07:04:48 Re: Another incorrect comment for pg_stat_statements
Previous Message Drouvot, Bertrand 2023-06-28 06:49:50 Re: Synchronizing slots from primary to standby