Re: Assert failure on bms_equal(child_joinrel->relids, child_joinrelids)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Guo <guofenglinux(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Assert failure on bms_equal(child_joinrel->relids, child_joinrelids)
Date: 2023-07-21 16:02:55
Message-ID: 960560.1689955375@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Richard Guo <guofenglinux(at)gmail(dot)com> writes:
> This should be an oversight in 9df8f903. It seems that the new added
> function add_outer_joins_to_relids() does not cope well with child
> joins. The 'input_relids' for a child join is the relid sets of child
> rels while 'othersj->min_xxxhand' refers to relids of parent rels. So
> there would be problem when we add the relids of the pushed-down joins.

Indeed. Adding the OJ relid itself works fine, but we won't get the
required matches when we scan the join_info_list.

> Instead of fixing add_outer_joins_to_relids() to cope with child joins,
> I'm wondering if we can build join relids for a child join from its
> parent by adjust_child_relids, something like attached.

That looks like a good solid solution. Pushed with a bit of
editorialization --- mostly, that I put the test case into
partition_join.sql where there's already suitable test tables.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2023-07-21 16:05:06 Re: Support worker_spi to execute the function dynamically.
Previous Message Etsuro Fujita 2023-07-21 12:51:31 Re: postgres_fdw: wrong results with self join + enable_nestloop off