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: v1-0001-Fix-how-we-build-join-relids-for-child-join.patch
Description: Binary data

Reply via email to