• Tom Lane's avatar
    Fix handling of init_plans list in inheritance_planner(). · 4ec6581c
    Tom Lane authored
    Formerly we passed an empty list to each per-child-table invocation of
    grouping_planner, and then merged the results into the global list.
    However, that fails if there's a CTE attached to the statement, because
    create_ctescan_plan uses the list to find the plan referenced by a CTE
    reference; so it was unable to find any CTEs attached to the outer UPDATE
    or DELETE.  But there's no real reason not to use the same list throughout
    the process, and doing so is simpler and faster anyway.
    
    Per report from Josh Berkus of "could not find plan for CTE" failures.
    Back-patch to 9.1 where we added support for WITH attached to UPDATE or
    DELETE.  Add some regression test cases, too.
    4ec6581c
with.out 37.6 KB