pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.
3+ messages / 1 participants
[nested] [flat]

* pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.
@ 2026-10-20 21:32  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2026-10-20 21:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.

set_deparse_context_plan() set the aliases for OLD and NEW in
RETURNING when EXPLAIN printed a ModifyTable, but that's the
wrong place: they should be set in set_deparse_plan() like other
plan-node-specific fields.  So they were not changed when
push_ancestor_plan() moved to the ancestor ModifyTable to print a
Param of a SubPlan in its RETURNING list, and the aliases of some
previously-printed ModifyTable could be used instead.  It seems
possible that we'd also fail to print an alias at all, since
get_variable() is unfazed by obtaining a NULL refname.  That
shouldn't happen for RETURNING variables, so complain.

Author: Henson Choi <assam258@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAAAe_zAUb_XydapJqUk7O8o2crJa7xbxX=KvSi3nY9h98OcN7g@mail.gmail.com
Backpatch-through: 18

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/1999fe227df70249dce7c9037147b54c1090b4ad

Modified Files
--------------
src/backend/utils/adt/ruleutils.c       | 30 ++++++++++------
src/test/regress/expected/returning.out | 64 +++++++++++++++++++++++++++++++++
src/test/regress/sql/returning.sql      | 24 +++++++++++++
3 files changed, 107 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.
@ 2026-10-20 21:32  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2026-10-20 21:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.

set_deparse_context_plan() set the aliases for OLD and NEW in
RETURNING when EXPLAIN printed a ModifyTable, but that's the
wrong place: they should be set in set_deparse_plan() like other
plan-node-specific fields.  So they were not changed when
push_ancestor_plan() moved to the ancestor ModifyTable to print a
Param of a SubPlan in its RETURNING list, and the aliases of some
previously-printed ModifyTable could be used instead.  It seems
possible that we'd also fail to print an alias at all, since
get_variable() is unfazed by obtaining a NULL refname.  That
shouldn't happen for RETURNING variables, so complain.

Author: Henson Choi <assam258@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAAAe_zAUb_XydapJqUk7O8o2crJa7xbxX=KvSi3nY9h98OcN7g@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/763f95c63c2daa7a0b57860d4fe1649e041845a7

Modified Files
--------------
src/backend/utils/adt/ruleutils.c       | 30 ++++++++++------
src/test/regress/expected/returning.out | 64 +++++++++++++++++++++++++++++++++
src/test/regress/sql/returning.sql      | 24 +++++++++++++
3 files changed, 107 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.
@ 2026-10-20 21:32  Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2026-10-20 21:32 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.

set_deparse_context_plan() set the aliases for OLD and NEW in
RETURNING when EXPLAIN printed a ModifyTable, but that's the
wrong place: they should be set in set_deparse_plan() like other
plan-node-specific fields.  So they were not changed when
push_ancestor_plan() moved to the ancestor ModifyTable to print a
Param of a SubPlan in its RETURNING list, and the aliases of some
previously-printed ModifyTable could be used instead.  It seems
possible that we'd also fail to print an alias at all, since
get_variable() is unfazed by obtaining a NULL refname.  That
shouldn't happen for RETURNING variables, so complain.

Author: Henson Choi <assam258@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/CAAAe_zAUb_XydapJqUk7O8o2crJa7xbxX=KvSi3nY9h98OcN7g@mail.gmail.com
Backpatch-through: 18

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/4ee8af2e86388dedb02f27a4384c9f46e9c7050a

Modified Files
--------------
src/backend/utils/adt/ruleutils.c       | 30 ++++++++++------
src/test/regress/expected/returning.out | 64 +++++++++++++++++++++++++++++++++
src/test/regress/sql/returning.sql      | 24 +++++++++++++
3 files changed, 107 insertions(+), 11 deletions(-)



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2026-10-20 21:32 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-10-20 21:32 pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 21:32 pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans. Tom Lane <tgl@sss.pgh.pa.us>
2026-10-20 21:32 pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans. Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox