Commit 94a3c603 authored by Tom Lane's avatar Tom Lane

Ditch ExecGetTupType() in favor of the much simpler ExecGetResultType(),

which does the same thing.  Perhaps at one time there was a reason to
allow plan nodes to store their result types in different places, but
AFAICT that's been unnecessary for a good while.
parent 20aea2ec
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.205 2003/03/27 16:51:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.206 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -634,7 +634,7 @@ InitPlan(QueryDesc *queryDesc) ...@@ -634,7 +634,7 @@ InitPlan(QueryDesc *queryDesc)
* (this is especially important if we are creating a relation with * (this is especially important if we are creating a relation with
* "SELECT INTO") * "SELECT INTO")
*/ */
tupType = ExecGetTupType(planstate); tupType = ExecGetResultType(planstate);
/* /*
* Initialize the junk filter if needed. SELECT and INSERT queries need a * Initialize the junk filter if needed. SELECT and INSERT queries need a
...@@ -713,7 +713,7 @@ InitPlan(QueryDesc *queryDesc) ...@@ -713,7 +713,7 @@ InitPlan(QueryDesc *queryDesc)
JunkFilter *j; JunkFilter *j;
j = ExecInitJunkFilter(subplan->plan->targetlist, j = ExecInitJunkFilter(subplan->plan->targetlist,
ExecGetTupType(subplan), ExecGetResultType(subplan),
ExecAllocTableSlot(estate->es_tupleTable)); ExecAllocTableSlot(estate->es_tupleTable));
resultRelInfo->ri_junkFilter = j; resultRelInfo->ri_junkFilter = j;
resultRelInfo++; resultRelInfo++;
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.35 2003/02/09 00:30:39 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.36 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
* ExecInitNode - initialize a plan node and its subplans * ExecInitNode - initialize a plan node and its subplans
* ExecProcNode - get a tuple by executing the plan node * ExecProcNode - get a tuple by executing the plan node
* ExecEndNode - shut down a plan node and its subplans * ExecEndNode - shut down a plan node and its subplans
* ExecGetTupType - get result tuple type of a plan node
* *
* NOTES * NOTES
* This used to be three files. It is now all combined into * This used to be three files. It is now all combined into
...@@ -602,181 +601,3 @@ ExecEndNode(PlanState *node) ...@@ -602,181 +601,3 @@ ExecEndNode(PlanState *node)
break; break;
} }
} }
/* ----------------------------------------------------------------
* ExecGetTupType
*
* this gives you the tuple descriptor for tuples returned
* by this node. I really wish I could ditch this routine,
* but since not all nodes store their type info in the same
* place, we have to do something special for each node type.
*
* ----------------------------------------------------------------
*/
TupleDesc
ExecGetTupType(PlanState *node)
{
TupleTableSlot *slot;
if (node == NULL)
return NULL;
switch (nodeTag(node))
{
case T_ResultState:
{
ResultState *resstate = (ResultState *) node;
slot = resstate->ps.ps_ResultTupleSlot;
}
break;
case T_AppendState:
{
AppendState *appendstate = (AppendState *) node;
slot = appendstate->ps.ps_ResultTupleSlot;
}
break;
case T_SeqScanState:
{
SeqScanState *scanstate = (SeqScanState *) node;
slot = scanstate->ps.ps_ResultTupleSlot;
}
break;
case T_IndexScanState:
{
IndexScanState *scanstate = (IndexScanState *) node;
slot = scanstate->ss.ps.ps_ResultTupleSlot;
}
break;
case T_TidScanState:
{
TidScanState *scanstate = (TidScanState *) node;
slot = scanstate->ss.ps.ps_ResultTupleSlot;
}
break;
case T_SubqueryScanState:
{
SubqueryScanState *scanstate = (SubqueryScanState *) node;
slot = scanstate->ss.ps.ps_ResultTupleSlot;
}
break;
case T_FunctionScanState:
{
FunctionScanState *scanstate = (FunctionScanState *) node;
slot = scanstate->ss.ps.ps_ResultTupleSlot;
}
break;
case T_NestLoopState:
{
NestLoopState *nlstate = (NestLoopState *) node;
slot = nlstate->js.ps.ps_ResultTupleSlot;
}
break;
case T_MergeJoinState:
{
MergeJoinState *mergestate = (MergeJoinState *) node;
slot = mergestate->js.ps.ps_ResultTupleSlot;
}
break;
case T_HashJoinState:
{
HashJoinState *hashjoinstate = (HashJoinState *) node;
slot = hashjoinstate->js.ps.ps_ResultTupleSlot;
}
break;
case T_MaterialState:
{
MaterialState *matstate = (MaterialState *) node;
slot = matstate->ss.ss_ScanTupleSlot;
}
break;
case T_SortState:
{
SortState *sortstate = (SortState *) node;
slot = sortstate->ss.ss_ScanTupleSlot;
}
break;
case T_GroupState:
{
GroupState *grpstate = (GroupState *) node;
slot = grpstate->ss.ps.ps_ResultTupleSlot;
}
break;
case T_AggState:
{
AggState *aggstate = (AggState *) node;
slot = aggstate->ss.ps.ps_ResultTupleSlot;
}
break;
case T_UniqueState:
{
UniqueState *uniquestate = (UniqueState *) node;
slot = uniquestate->ps.ps_ResultTupleSlot;
}
break;
case T_HashState:
{
HashState *hashstate = (HashState *) node;
slot = hashstate->ps.ps_ResultTupleSlot;
}
break;
case T_SetOpState:
{
SetOpState *setopstate = (SetOpState *) node;
slot = setopstate->ps.ps_ResultTupleSlot;
}
break;
case T_LimitState:
{
LimitState *limitstate = (LimitState *) node;
slot = limitstate->ps.ps_ResultTupleSlot;
}
break;
default:
/*
* should never get here
*/
elog(ERROR, "ExecGetTupType: node type %d unsupported",
(int) nodeTag(node));
return NULL;
}
return slot->ttc_tupleDescriptor;
}
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.98 2003/02/09 06:56:27 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.99 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -413,7 +413,7 @@ ExecAssignResultTypeFromOuterPlan(PlanState *planstate) ...@@ -413,7 +413,7 @@ ExecAssignResultTypeFromOuterPlan(PlanState *planstate)
TupleDesc tupDesc; TupleDesc tupDesc;
outerPlan = outerPlanState(planstate); outerPlan = outerPlanState(planstate);
tupDesc = ExecGetTupType(outerPlan); tupDesc = ExecGetResultType(outerPlan);
ExecAssignResultType(planstate, tupDesc, false); ExecAssignResultType(planstate, tupDesc, false);
} }
...@@ -606,7 +606,7 @@ ExecAssignScanTypeFromOuterPlan(ScanState *scanstate) ...@@ -606,7 +606,7 @@ ExecAssignScanTypeFromOuterPlan(ScanState *scanstate)
TupleDesc tupDesc; TupleDesc tupDesc;
outerPlan = outerPlanState(scanstate); outerPlan = outerPlanState(scanstate);
tupDesc = ExecGetTupType(outerPlan); tupDesc = ExecGetResultType(outerPlan);
ExecAssignScanType(scanstate, tupDesc, false); ExecAssignScanType(scanstate, tupDesc, false);
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.49 2003/03/27 16:51:27 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.50 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -374,7 +374,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate) ...@@ -374,7 +374,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
case JOIN_LEFT: case JOIN_LEFT:
hjstate->hj_NullInnerTupleSlot = hjstate->hj_NullInnerTupleSlot =
ExecInitNullTupleSlot(estate, ExecInitNullTupleSlot(estate,
ExecGetTupType(innerPlanState(hjstate))); ExecGetResultType(innerPlanState(hjstate)));
break; break;
default: default:
elog(ERROR, "ExecInitHashJoin: unsupported join type %d", elog(ERROR, "ExecInitHashJoin: unsupported join type %d",
...@@ -402,7 +402,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate) ...@@ -402,7 +402,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
ExecAssignProjectionInfo(&hjstate->js.ps); ExecAssignProjectionInfo(&hjstate->js.ps);
ExecSetSlotDescriptor(hjstate->hj_OuterTupleSlot, ExecSetSlotDescriptor(hjstate->hj_OuterTupleSlot,
ExecGetTupType(outerPlanState(hjstate)), ExecGetResultType(outerPlanState(hjstate)),
false); false);
/* /*
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.56 2003/01/20 18:54:45 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.57 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1453,7 +1453,7 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate) ...@@ -1453,7 +1453,7 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
mergestate->mj_MarkedTupleSlot = ExecInitExtraTupleSlot(estate); mergestate->mj_MarkedTupleSlot = ExecInitExtraTupleSlot(estate);
ExecSetSlotDescriptor(mergestate->mj_MarkedTupleSlot, ExecSetSlotDescriptor(mergestate->mj_MarkedTupleSlot,
ExecGetTupType(innerPlanState(mergestate)), ExecGetResultType(innerPlanState(mergestate)),
false); false);
switch (node->join.jointype) switch (node->join.jointype)
...@@ -1464,12 +1464,12 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate) ...@@ -1464,12 +1464,12 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
case JOIN_LEFT: case JOIN_LEFT:
mergestate->mj_NullInnerTupleSlot = mergestate->mj_NullInnerTupleSlot =
ExecInitNullTupleSlot(estate, ExecInitNullTupleSlot(estate,
ExecGetTupType(innerPlanState(mergestate))); ExecGetResultType(innerPlanState(mergestate)));
break; break;
case JOIN_RIGHT: case JOIN_RIGHT:
mergestate->mj_NullOuterTupleSlot = mergestate->mj_NullOuterTupleSlot =
ExecInitNullTupleSlot(estate, ExecInitNullTupleSlot(estate,
ExecGetTupType(outerPlanState(mergestate))); ExecGetResultType(outerPlanState(mergestate)));
/* /*
* Can't handle right or full join with non-nil extra * Can't handle right or full join with non-nil extra
...@@ -1481,10 +1481,10 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate) ...@@ -1481,10 +1481,10 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
case JOIN_FULL: case JOIN_FULL:
mergestate->mj_NullOuterTupleSlot = mergestate->mj_NullOuterTupleSlot =
ExecInitNullTupleSlot(estate, ExecInitNullTupleSlot(estate,
ExecGetTupType(outerPlanState(mergestate))); ExecGetResultType(outerPlanState(mergestate)));
mergestate->mj_NullInnerTupleSlot = mergestate->mj_NullInnerTupleSlot =
ExecInitNullTupleSlot(estate, ExecInitNullTupleSlot(estate,
ExecGetTupType(innerPlanState(mergestate))); ExecGetResultType(innerPlanState(mergestate)));
/* /*
* Can't handle right or full join with non-nil extra * Can't handle right or full join with non-nil extra
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.31 2003/01/27 20:51:48 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.32 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -330,7 +330,7 @@ ExecInitNestLoop(NestLoop *node, EState *estate) ...@@ -330,7 +330,7 @@ ExecInitNestLoop(NestLoop *node, EState *estate)
case JOIN_LEFT: case JOIN_LEFT:
nlstate->nl_NullInnerTupleSlot = nlstate->nl_NullInnerTupleSlot =
ExecInitNullTupleSlot(estate, ExecInitNullTupleSlot(estate,
ExecGetTupType(innerPlanState(nlstate))); ExecGetResultType(innerPlanState(nlstate)));
break; break;
default: default:
elog(ERROR, "ExecInitNestLoop: unsupported join type %d", elog(ERROR, "ExecInitNestLoop: unsupported join type %d",
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.42 2002/12/15 16:17:46 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.43 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -137,7 +137,7 @@ ExecSort(SortState *node) ...@@ -137,7 +137,7 @@ ExecSort(SortState *node)
"calling tuplesort_begin"); "calling tuplesort_begin");
outerNode = outerPlanState(node); outerNode = outerPlanState(node);
tupDesc = ExecGetTupType(outerNode); tupDesc = ExecGetResultType(outerNode);
ExtractSortKeys(plannode, &sortOperators, &attNums); ExtractSortKeys(plannode, &sortOperators, &attNums);
...@@ -173,11 +173,6 @@ ExecSort(SortState *node) ...@@ -173,11 +173,6 @@ ExecSort(SortState *node)
*/ */
estate->es_direction = dir; estate->es_direction = dir;
/*
* make sure the tuple descriptor is up to date (is this needed?)
*/
ExecAssignResultType(&node->ss.ps, tupDesc, false);
/* /*
* finally set the sorted flag to true * finally set the sorted flag to true
*/ */
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: executor.h,v 1.91 2003/03/11 19:40:23 tgl Exp $ * $Id: executor.h,v 1.92 2003/05/05 17:57:47 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -101,7 +101,6 @@ extern PlanState *ExecInitNode(Plan *node, EState *estate); ...@@ -101,7 +101,6 @@ extern PlanState *ExecInitNode(Plan *node, EState *estate);
extern TupleTableSlot *ExecProcNode(PlanState *node); extern TupleTableSlot *ExecProcNode(PlanState *node);
extern int ExecCountSlotsNode(Plan *node); extern int ExecCountSlotsNode(Plan *node);
extern void ExecEndNode(PlanState *node); extern void ExecEndNode(PlanState *node);
extern TupleDesc ExecGetTupType(PlanState *node);
/* /*
* prototypes from functions in execQual.c * prototypes from functions in execQual.c
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment