I thought about this solution before but proved it was not right in
https://www.postgresql.org/message-id/CAMbWs48fObJJ%3DYVb4ip8tnwxwixUNKUThfnA1eGfPzJxJRRgZQ%40mail.gmail.comI checked the query shown there and it still fails with v3 patch.
explain (costs off)
select * from t1
left join (select t2.x from t2
left join t3 on t2.x where t3.x is null) s
left join t4 on s.x
on s.x = t1.x;
server closed the connection unexpectedly
The failure happens when we are forming the join of (t1/t2) to t3.
Consider qual 't3.x is null'. It's a non-clone filter clause so
clause_is_computable_at is supposed to think it's applicable here. We
have an Assert for that. However, when checking outer join t1/t2, which
has been performed but is not listed in the qual's nullingrels,
clause_is_computable_at would think it'd null vars of the qual if we
check syn_righthand not min_righthand, and get a conclusion that the
qual is not applicable here. This is how the Assert is triggered.
Thanks
Richard