Re: Assert failure on bms_equal(child_joinrel->relids, child_joinrelids) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Assert failure on bms_equal(child_joinrel->relids, child_joinrelids)
Date
Msg-id 960560.1689955375@sss.pgh.pa.us
Whole thread Raw
In response to Assert failure on bms_equal(child_joinrel->relids, child_joinrelids)  (Richard Guo <guofenglinux@gmail.com>)
Responses Re: Assert failure on bms_equal(child_joinrel->relids, child_joinrelids)
List pgsql-hackers
Richard Guo <guofenglinux@gmail.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



pgsql-hackers by date:

Previous
From: Etsuro Fujita
Date:
Subject: Re: postgres_fdw: wrong results with self join + enable_nestloop off
Next
From: Bharath Rupireddy
Date:
Subject: Re: Support worker_spi to execute the function dynamically.