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

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Assert failure on bms_equal(child_joinrel->relids, child_joinrelids)
Date: 2023-07-21 10:02:10
Message-ID: CAMbWs49NCNbyubZWgci3o=_OTY=snCfAPtMnM-32f3mm-K-Ckw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

This Assert failure can be reproduced with the query below.

create table part_tbl (a integer) partition by range (a);
create table part_tbl1 partition of part_tbl for values from (0) to (100);
set enable_partitionwise_join to on;

explain (costs off)
select * from part_tbl t1
left join part_tbl t2 on t1.a = t2.a
left join part_tbl t3 on t2.a = t3.a;
server closed the connection unexpectedly

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.

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.

Thanks
Richard

Attachment Content-Type Size
v1-0001-Fix-how-we-build-join-relids-for-child-join.patch application/octet-stream 6.1 KB

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2023-07-21 10:33:11 Re: remaining sql/json patches
Previous Message Melih Mutlu 2023-07-21 09:51:56 Re: [PATCH] Reuse Workers and Replication Slots during Logical Replication