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-29 07:39:38
Message-ID: CAMbWs4_UoVcCwkVMfi9TjSC=o5U6BRHUNZiVhrvSbDfU2HaeDA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 28, 2023 at 10:09 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message John Morris 2023-06-29 07:50:17 Unified File API
Previous Message Thomas Munro 2023-06-29 07:35:30 Re: ReadRecentBuffer() doesn't scale well