pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.
pgsql: Fix OLD/NEW aliases that EXPLAIN prints in RETURNING SubPlans.
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
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 Reviewed-by: Tom Lane 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(-)