Get rid of ExecAssignResultTypeFromOuterPlan() and make all plan node types
authorTom Lane <tgl@sss.pgh.pa.us>
Wed, 23 Nov 2005 20:28:05 +0000 (20:28 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Wed, 23 Nov 2005 20:28:05 +0000 (20:28 +0000)
generate their output tuple descriptors from their target lists (ie, using
ExecAssignResultTypeFromTL()).  We long ago fixed things so that all node
types have minimally valid tlists, so there's no longer any good reason to
have two different ways of doing it.  This change is needed to fix bug
reported by Hayden James: the fix of 2005-11-03 to emit the correct column
names after optimizing away a SubqueryScan node didn't work if the new
top-level plan node used ExecAssignResultTypeFromOuterPlan to generate its
tupdesc, since the next plan node down won't have the correct column labels.

src/backend/executor/execUtils.c
src/backend/executor/nodeHash.c
src/backend/executor/nodeLimit.c
src/backend/executor/nodeMaterial.c
src/backend/executor/nodeSetOp.c
src/backend/executor/nodeSort.c
src/backend/executor/nodeUnique.c
src/include/executor/executor.h

index e73b347e0997a8069f06ed47aa3183e2cd38a562..a9b245d4b352a343e7d7387f67c6e8e94ac95ee3 100644 (file)
@@ -435,22 +435,6 @@ ExecAssignResultType(PlanState *planstate,
        ExecSetSlotDescriptor(slot, tupDesc, shouldFree);
 }
 
-/* ----------------
- *             ExecAssignResultTypeFromOuterPlan
- * ----------------
- */
-void
-ExecAssignResultTypeFromOuterPlan(PlanState *planstate)
-{
-       PlanState  *outerPlan;
-       TupleDesc       tupDesc;
-
-       outerPlan = outerPlanState(planstate);
-       tupDesc = ExecGetResultType(outerPlan);
-
-       ExecAssignResultType(planstate, tupDesc, false);
-}
-
 /* ----------------
  *             ExecAssignResultTypeFromTL
  * ----------------
index 34e0ce8a930691658944378d948170802c1319a4..d0fe9704d1a9d455e5d8650e640bc343e68e0b1e 100644 (file)
@@ -164,7 +164,7 @@ ExecInitHash(Hash *node, EState *estate)
         * initialize tuple type. no need to initialize projection info because
         * this node doesn't do projections
         */
-       ExecAssignResultTypeFromOuterPlan(&hashstate->ps);
+       ExecAssignResultTypeFromTL(&hashstate->ps);
        hashstate->ps.ps_ProjInfo = NULL;
 
        return hashstate;
index 13cbf7644518e3d2e6c1ef5d60f40c911fdecb55..5769384600dc58cb7524e5f19b5ce9545d14efe0 100644 (file)
@@ -327,7 +327,7 @@ ExecInitLimit(Limit *node, EState *estate)
         * limit nodes do no projections, so initialize projection info for this
         * node appropriately
         */
-       ExecAssignResultTypeFromOuterPlan(&limitstate->ps);
+       ExecAssignResultTypeFromTL(&limitstate->ps);
        limitstate->ps.ps_ProjInfo = NULL;
 
        return limitstate;
index 9e84dcd7804de4d4472c66077efbfd0cf7c2d1bc..10517f5fa5a973f414fe87da2a7d2b1423a5d8d7 100644 (file)
@@ -195,7 +195,7 @@ ExecInitMaterial(Material *node, EState *estate)
         * initialize tuple type.  no need to initialize projection info because
         * this node doesn't do projections.
         */
-       ExecAssignResultTypeFromOuterPlan(&matstate->ss.ps);
+       ExecAssignResultTypeFromTL(&matstate->ss.ps);
        ExecAssignScanTypeFromOuterPlan(&matstate->ss);
        matstate->ss.ps.ps_ProjInfo = NULL;
 
index d962af713dd44dc7458d5bf455f79c00efdcb404..991ad9cc86454f97062e3c9a3e59d27910b2cdc9 100644 (file)
@@ -258,7 +258,7 @@ ExecInitSetOp(SetOp *node, EState *estate)
         * setop nodes do no projections, so initialize projection info for this
         * node appropriately
         */
-       ExecAssignResultTypeFromOuterPlan(&setopstate->ps);
+       ExecAssignResultTypeFromTL(&setopstate->ps);
        setopstate->ps.ps_ProjInfo = NULL;
 
        /*
index d27207b1d2f221b50199afd15a09c915d96015d7..2d228652f62700757b78f2cc2daa9661846c4415 100644 (file)
@@ -193,7 +193,7 @@ ExecInitSort(Sort *node, EState *estate)
         * initialize tuple type.  no need to initialize projection info because
         * this node doesn't do projections.
         */
-       ExecAssignResultTypeFromOuterPlan(&sortstate->ss.ps);
+       ExecAssignResultTypeFromTL(&sortstate->ss.ps);
        ExecAssignScanTypeFromOuterPlan(&sortstate->ss);
        sortstate->ss.ps.ps_ProjInfo = NULL;
 
index 8c5c50127b86a0b55e819871f067db7dc0848b9d..3e6999daedece6089b18cc8785badbf80cd44318 100644 (file)
@@ -150,7 +150,7 @@ ExecInitUnique(Unique *node, EState *estate)
         * unique nodes do no projections, so initialize projection info for this
         * node appropriately
         */
-       ExecAssignResultTypeFromOuterPlan(&uniquestate->ps);
+       ExecAssignResultTypeFromTL(&uniquestate->ps);
        uniquestate->ps.ps_ProjInfo = NULL;
 
        /*
index 031e3131674bc2660bb33ec16a855cf8266ebc88..75fefa4a4fe63836c572ba1867beb8a09a1725f9 100644 (file)
@@ -218,7 +218,6 @@ extern ExprContext *MakePerTupleExprContext(EState *estate);
 extern void ExecAssignExprContext(EState *estate, PlanState *planstate);
 extern void ExecAssignResultType(PlanState *planstate,
                                         TupleDesc tupDesc, bool shouldFree);
-extern void ExecAssignResultTypeFromOuterPlan(PlanState *planstate);
 extern void ExecAssignResultTypeFromTL(PlanState *planstate);
 extern TupleDesc ExecGetResultType(PlanState *planstate);
 extern ProjectionInfo *ExecBuildProjectionInfo(List *targetList,