Dont pullup correlated subqueries with limit/offset clause
Queries in which there is a IN clause on top of a correlated subquery containing limit/offset clause, planner tries to identify if the IN clause can be converted to a join in convert_IN_to_join() and creates a RTE for the join if its possible and does not consider limit/offset clause while making a decision. However, later in pull_up_subqueries(), check enforced by is_simple_subquery causes the subquery containing limit/offset clauses to be not pulled up. This inconsistency causes a plan to be generated with a param, however, with no corresponding subplan. The patch fixes the issues by adding the relevant checks in convert_IN_to_join() to identify if the subquery is correlated and contains limit/offset clause, in such cases the sublink will not be converted to a join and a plan with subplan will be created.
Showing
想要评论请 注册 或 登录