| From: | Dean Rasheed <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix MERGE into partitioned table with subquery in UPDATE targetl |
| Date: | 2026-11-11 12:27:11 |
| Message-ID: | E1xR7Pz-00000000JN0-0xyk@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
Fix MERGE into partitioned table with subquery in UPDATE targetlist.
Under some circumstances, a MERGE into a partitioned table with an
UPDATE action with a subquery in its targetlist would fail with a
"SubPlan found with no parent plan" error.
This was due to ExecInitPartitionInfo() passing a NULL parent
PlanState to ExecBuildUpdateProjection() for the MERGE UPDATE action's
targetlist. Fix by passing &mtstate->ps, like ExecInitMerge().
Backpatch to v15, where MERGE was introduced.
Bug: #19802
Reported-by: Gowtham Reddy <gowthamdoma18(at)gmail(dot)com>
Author: Tender Wang <tndrwang(at)gmail(dot)com>
Reviewed-by: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Discussion: https://postgr.es/m/19802-ef50a8f1a4b5deee%40postgresql.org
Backpatch-through: 15
Branch
------
REL_15_STABLE
Details
-------
https://git.postgresql.org/pg/commitdiff/291a641ab77ea41fe83c141d1cbb865f2b32d5de
Modified Files
--------------
src/backend/executor/execPartition.c | 2 +-
src/test/regress/expected/merge.out | 15 +++++++++++++++
src/test/regress/sql/merge.sql | 11 +++++++++++
3 files changed, 27 insertions(+), 1 deletion(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Álvaro Herrera | 2026-11-11 15:17:47 | pgsql: Remove open-coding of index_set_state_flags |
| Previous Message | Peter Eisentraut | 2026-11-11 08:03:10 | pgsql: Add translators to release notes credits |