Richard Guo <guofenglinux(at)gmail(dot)com> 于2026年10月8日周四 14:12写道:
> So I think we can fix it by teaching that search to also include any
> rel that laterally references a rel already in the set. Hench, the
> attached.
>
Thanks for the explanation and patch. I traced this through
join_is_legal() and now understand why the existing check misses the
dead end.
Starting with {t1, s2}, the outer-join search adds t2, but stops
because it does not follow the lateral dependency from t2 to s1.
Including s1 allows the next iteration to add t3, revealing the
conflict with the proposed join's lateral parameterization.
The fix makes sense to me.
--
Thanks,
Tender Wang