diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-28 18:51:56 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2009-10-28 18:51:56 +0000 |
commit | 77c666fe422b99675ac285fecc0253fc4fe2bb7c (patch) | |
tree | 35c4ad703c6976f7f1dadb0bf84586d2be325b90 | |
parent | be6899f13941d42fe4ae2b71023241d22ecae8b8 (diff) | |
download | postgresql-77c666fe422b99675ac285fecc0253fc4fe2bb7c.tar.gz postgresql-77c666fe422b99675ac285fecc0253fc4fe2bb7c.zip |
Un-break EXPLAIN for Append plans. I messed this up a few days ago while
adding the ModifyTable node type --- I had been thinking ModifyTable should
replace Append as a special case in push_plan(), but actually both of them
have to be special-cased.
-rw-r--r-- | src/backend/utils/adt/ruleutils.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c index 99dfd88ba52..adf3e648026 100644 --- a/src/backend/utils/adt/ruleutils.c +++ b/src/backend/utils/adt/ruleutils.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.312 2009/10/28 17:36:50 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/ruleutils.c,v 1.313 2009/10/28 18:51:56 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3370,11 +3370,16 @@ static void push_plan(deparse_namespace *dpns, Plan *subplan) { /* - * We special-case ModifyTable to pretend that the first child plan is the - * OUTER referent; otherwise normal. This is to support RETURNING lists - * containing references to non-target relations. + * We special-case Append to pretend that the first child plan is the + * OUTER referent; we have to interpret OUTER Vars in the Append's tlist + * according to one of the children, and the first one is the most + * natural choice. Likewise special-case ModifyTable to pretend that the + * first child plan is the OUTER referent; this is to support RETURNING + * lists containing references to non-target relations. */ - if (IsA(subplan, ModifyTable)) + if (IsA(subplan, Append)) + dpns->outer_plan = (Plan *) linitial(((Append *) subplan)->appendplans); + else if (IsA(subplan, ModifyTable)) dpns->outer_plan = (Plan *) linitial(((ModifyTable *) subplan)->plans); else dpns->outer_plan = outerPlan(subplan); |