Revise min_lefthand/min_righthand in SpecialJoinInfo for LASJ.
Previously, we did not consider LASJ when calculating the minimum sets
of Relids required on each side of the join to form the outer join. As a
result, the min_lefthand/min_righthand for LASJ was not correct.
One of the consequences is that join_is_legal() works incorrectly for
some queries, such as
select * from a where a.i not in
(select b.i from b left join c on b.i = c.i);
For this query, join_is_legal() treats the join of Rel B and C as being
illegal, because the min_righthand of the LASJ includes only B, rather
than B and C. That would make us fail to find any legal join order and
end up with "ERROR: failed to build any 2-way joins".
This patch revises min_lefthand/min_righthand in SpecialJoinInfo for
LASJ. It also removes the FIXME in join_is_legal(), which is an ugly
workaround to make the query above work.
Reviewed-by: NMelanie Plageman <mplageman@pivotal.io>
Showing
想要评论请 注册 或 登录