Fix EXPLAIN output for cases where parent table is excluded by constraints.
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Feb 2015 23:04:11 +0000 (18:04 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 17 Feb 2015 23:04:11 +0000 (18:04 -0500)
commitabe45a9b315d7b3739f442597f570f9454bd466d
tree7d4005816c81f185cc14df78a110e9d81e7e072d
parent931bf3eb9b203ca02d729f5122a44cc250c27695
Fix EXPLAIN output for cases where parent table is excluded by constraints.

The previous coding in EXPLAIN always labeled a ModifyTable node with the
name of the target table affected by its first child plan.  When originally
written, this was necessarily the parent table of the inheritance tree,
so everything was unconfusing.  But when we added NO INHERIT constraints,
it became possible for the parent table to be deleted from the plan by
constraint exclusion while still leaving child tables present.  This led to
the ModifyTable plan node being labeled with the first surviving child,
which was deemed confusing.  Fix it by retaining the parent table's RT
index in a new field in ModifyTable.

Etsuro Fujita, reviewed by Ashutosh Bapat and myself
src/backend/commands/explain.c
src/backend/nodes/copyfuncs.c
src/backend/nodes/outfuncs.c
src/backend/optimizer/plan/createplan.c
src/backend/optimizer/plan/planner.c
src/backend/optimizer/plan/setrefs.c
src/include/nodes/plannodes.h
src/include/optimizer/planmain.h