pgsql: Fix corner-case planner failure for MERGE.

2023-03-28 Thread Tom Lane
Fix corner-case planner failure for MERGE. MERGE planning could fail with "variable not found in subplan target list" if the target table is partitioned and all its partitions are excluded at plan time, or in the case where it has no partitions but used to have some. This happened because distrib

pgsql: Fix corner-case planner failure for MERGE.

2023-03-28 Thread Tom Lane
Fix corner-case planner failure for MERGE. MERGE planning could fail with "variable not found in subplan target list" if the target table is partitioned and all its partitions are excluded at plan time, or in the case where it has no partitions but used to have some. This happened because distrib