Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 94a3c60

Browse files
committed
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.
1 parent 20aea2e commit 94a3c60

File tree

8 files changed

+21
-206
lines changed

8 files changed

+21
-206
lines changed

src/backend/executor/execMain.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*
2727
*
2828
* IDENTIFICATION
29-
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.205 2003/03/27 16:51:27 momjian Exp $
29+
* $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.206 2003/05/05 17:57:47 tgl Exp $
3030
*
3131
*-------------------------------------------------------------------------
3232
*/
@@ -634,7 +634,7 @@ InitPlan(QueryDesc *queryDesc)
634634
* (this is especially important if we are creating a relation with
635635
* "SELECT INTO")
636636
*/
637-
tupType = ExecGetTupType(planstate);
637+
tupType = ExecGetResultType(planstate);
638638

639639
/*
640640
* Initialize the junk filter if needed. SELECT and INSERT queries need a
@@ -713,7 +713,7 @@ InitPlan(QueryDesc *queryDesc)
713713
JunkFilter *j;
714714

715715
j = ExecInitJunkFilter(subplan->plan->targetlist,
716-
ExecGetTupType(subplan),
716+
ExecGetResultType(subplan),
717717
ExecAllocTableSlot(estate->es_tupleTable));
718718
resultRelInfo->ri_junkFilter = j;
719719
resultRelInfo++;

src/backend/executor/execProcnode.c

Lines changed: 1 addition & 180 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
*
1414
* IDENTIFICATION
15-
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.35 2003/02/09 00:30:39 tgl Exp $
15+
* $Header: /cvsroot/pgsql/src/backend/executor/execProcnode.c,v 1.36 2003/05/05 17:57:47 tgl Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -22,7 +22,6 @@
2222
* ExecInitNode - initialize a plan node and its subplans
2323
* ExecProcNode - get a tuple by executing the plan node
2424
* ExecEndNode - shut down a plan node and its subplans
25-
* ExecGetTupType - get result tuple type of a plan node
2625
*
2726
* NOTES
2827
* This used to be three files. It is now all combined into
@@ -602,181 +601,3 @@ ExecEndNode(PlanState *node)
602601
break;
603602
}
604603
}
605-
606-
607-
/* ----------------------------------------------------------------
608-
* ExecGetTupType
609-
*
610-
* this gives you the tuple descriptor for tuples returned
611-
* by this node. I really wish I could ditch this routine,
612-
* but since not all nodes store their type info in the same
613-
* place, we have to do something special for each node type.
614-
*
615-
* ----------------------------------------------------------------
616-
*/
617-
TupleDesc
618-
ExecGetTupType(PlanState *node)
619-
{
620-
TupleTableSlot *slot;
621-
622-
if (node == NULL)
623-
return NULL;
624-
625-
switch (nodeTag(node))
626-
{
627-
case T_ResultState:
628-
{
629-
ResultState *resstate = (ResultState *) node;
630-
631-
slot = resstate->ps.ps_ResultTupleSlot;
632-
}
633-
break;
634-
635-
case T_AppendState:
636-
{
637-
AppendState *appendstate = (AppendState *) node;
638-
639-
slot = appendstate->ps.ps_ResultTupleSlot;
640-
}
641-
break;
642-
643-
case T_SeqScanState:
644-
{
645-
SeqScanState *scanstate = (SeqScanState *) node;
646-
647-
slot = scanstate->ps.ps_ResultTupleSlot;
648-
}
649-
break;
650-
651-
case T_IndexScanState:
652-
{
653-
IndexScanState *scanstate = (IndexScanState *) node;
654-
655-
slot = scanstate->ss.ps.ps_ResultTupleSlot;
656-
}
657-
break;
658-
659-
case T_TidScanState:
660-
{
661-
TidScanState *scanstate = (TidScanState *) node;
662-
663-
slot = scanstate->ss.ps.ps_ResultTupleSlot;
664-
}
665-
break;
666-
667-
case T_SubqueryScanState:
668-
{
669-
SubqueryScanState *scanstate = (SubqueryScanState *) node;
670-
671-
slot = scanstate->ss.ps.ps_ResultTupleSlot;
672-
}
673-
break;
674-
675-
case T_FunctionScanState:
676-
{
677-
FunctionScanState *scanstate = (FunctionScanState *) node;
678-
679-
slot = scanstate->ss.ps.ps_ResultTupleSlot;
680-
}
681-
break;
682-
683-
case T_NestLoopState:
684-
{
685-
NestLoopState *nlstate = (NestLoopState *) node;
686-
687-
slot = nlstate->js.ps.ps_ResultTupleSlot;
688-
}
689-
break;
690-
691-
case T_MergeJoinState:
692-
{
693-
MergeJoinState *mergestate = (MergeJoinState *) node;
694-
695-
slot = mergestate->js.ps.ps_ResultTupleSlot;
696-
}
697-
break;
698-
699-
case T_HashJoinState:
700-
{
701-
HashJoinState *hashjoinstate = (HashJoinState *) node;
702-
703-
slot = hashjoinstate->js.ps.ps_ResultTupleSlot;
704-
}
705-
break;
706-
707-
case T_MaterialState:
708-
{
709-
MaterialState *matstate = (MaterialState *) node;
710-
711-
slot = matstate->ss.ss_ScanTupleSlot;
712-
}
713-
break;
714-
715-
case T_SortState:
716-
{
717-
SortState *sortstate = (SortState *) node;
718-
719-
slot = sortstate->ss.ss_ScanTupleSlot;
720-
}
721-
break;
722-
723-
case T_GroupState:
724-
{
725-
GroupState *grpstate = (GroupState *) node;
726-
727-
slot = grpstate->ss.ps.ps_ResultTupleSlot;
728-
}
729-
break;
730-
731-
case T_AggState:
732-
{
733-
AggState *aggstate = (AggState *) node;
734-
735-
slot = aggstate->ss.ps.ps_ResultTupleSlot;
736-
}
737-
break;
738-
739-
case T_UniqueState:
740-
{
741-
UniqueState *uniquestate = (UniqueState *) node;
742-
743-
slot = uniquestate->ps.ps_ResultTupleSlot;
744-
}
745-
break;
746-
747-
case T_HashState:
748-
{
749-
HashState *hashstate = (HashState *) node;
750-
751-
slot = hashstate->ps.ps_ResultTupleSlot;
752-
}
753-
break;
754-
755-
case T_SetOpState:
756-
{
757-
SetOpState *setopstate = (SetOpState *) node;
758-
759-
slot = setopstate->ps.ps_ResultTupleSlot;
760-
}
761-
break;
762-
763-
case T_LimitState:
764-
{
765-
LimitState *limitstate = (LimitState *) node;
766-
767-
slot = limitstate->ps.ps_ResultTupleSlot;
768-
}
769-
break;
770-
771-
default:
772-
773-
/*
774-
* should never get here
775-
*/
776-
elog(ERROR, "ExecGetTupType: node type %d unsupported",
777-
(int) nodeTag(node));
778-
return NULL;
779-
}
780-
781-
return slot->ttc_tupleDescriptor;
782-
}

src/backend/executor/execUtils.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.98 2003/02/09 06:56:27 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.99 2003/05/05 17:57:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -413,7 +413,7 @@ ExecAssignResultTypeFromOuterPlan(PlanState *planstate)
413413
TupleDesc tupDesc;
414414

415415
outerPlan = outerPlanState(planstate);
416-
tupDesc = ExecGetTupType(outerPlan);
416+
tupDesc = ExecGetResultType(outerPlan);
417417

418418
ExecAssignResultType(planstate, tupDesc, false);
419419
}
@@ -606,7 +606,7 @@ ExecAssignScanTypeFromOuterPlan(ScanState *scanstate)
606606
TupleDesc tupDesc;
607607

608608
outerPlan = outerPlanState(scanstate);
609-
tupDesc = ExecGetTupType(outerPlan);
609+
tupDesc = ExecGetResultType(outerPlan);
610610

611611
ExecAssignScanType(scanstate, tupDesc, false);
612612
}

src/backend/executor/nodeHashjoin.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.49 2003/03/27 16:51:27 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.50 2003/05/05 17:57:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -374,7 +374,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
374374
case JOIN_LEFT:
375375
hjstate->hj_NullInnerTupleSlot =
376376
ExecInitNullTupleSlot(estate,
377-
ExecGetTupType(innerPlanState(hjstate)));
377+
ExecGetResultType(innerPlanState(hjstate)));
378378
break;
379379
default:
380380
elog(ERROR, "ExecInitHashJoin: unsupported join type %d",
@@ -402,7 +402,7 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
402402
ExecAssignProjectionInfo(&hjstate->js.ps);
403403

404404
ExecSetSlotDescriptor(hjstate->hj_OuterTupleSlot,
405-
ExecGetTupType(outerPlanState(hjstate)),
405+
ExecGetResultType(outerPlanState(hjstate)),
406406
false);
407407

408408
/*

src/backend/executor/nodeMergejoin.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.56 2003/01/20 18:54:45 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.57 2003/05/05 17:57:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -1453,7 +1453,7 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
14531453

14541454
mergestate->mj_MarkedTupleSlot = ExecInitExtraTupleSlot(estate);
14551455
ExecSetSlotDescriptor(mergestate->mj_MarkedTupleSlot,
1456-
ExecGetTupType(innerPlanState(mergestate)),
1456+
ExecGetResultType(innerPlanState(mergestate)),
14571457
false);
14581458

14591459
switch (node->join.jointype)
@@ -1464,12 +1464,12 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
14641464
case JOIN_LEFT:
14651465
mergestate->mj_NullInnerTupleSlot =
14661466
ExecInitNullTupleSlot(estate,
1467-
ExecGetTupType(innerPlanState(mergestate)));
1467+
ExecGetResultType(innerPlanState(mergestate)));
14681468
break;
14691469
case JOIN_RIGHT:
14701470
mergestate->mj_NullOuterTupleSlot =
14711471
ExecInitNullTupleSlot(estate,
1472-
ExecGetTupType(outerPlanState(mergestate)));
1472+
ExecGetResultType(outerPlanState(mergestate)));
14731473

14741474
/*
14751475
* Can't handle right or full join with non-nil extra
@@ -1481,10 +1481,10 @@ ExecInitMergeJoin(MergeJoin *node, EState *estate)
14811481
case JOIN_FULL:
14821482
mergestate->mj_NullOuterTupleSlot =
14831483
ExecInitNullTupleSlot(estate,
1484-
ExecGetTupType(outerPlanState(mergestate)));
1484+
ExecGetResultType(outerPlanState(mergestate)));
14851485
mergestate->mj_NullInnerTupleSlot =
14861486
ExecInitNullTupleSlot(estate,
1487-
ExecGetTupType(innerPlanState(mergestate)));
1487+
ExecGetResultType(innerPlanState(mergestate)));
14881488

14891489
/*
14901490
* Can't handle right or full join with non-nil extra

src/backend/executor/nodeNestloop.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.31 2003/01/27 20:51:48 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.32 2003/05/05 17:57:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -330,7 +330,7 @@ ExecInitNestLoop(NestLoop *node, EState *estate)
330330
case JOIN_LEFT:
331331
nlstate->nl_NullInnerTupleSlot =
332332
ExecInitNullTupleSlot(estate,
333-
ExecGetTupType(innerPlanState(nlstate)));
333+
ExecGetResultType(innerPlanState(nlstate)));
334334
break;
335335
default:
336336
elog(ERROR, "ExecInitNestLoop: unsupported join type %d",

src/backend/executor/nodeSort.c

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.42 2002/12/15 16:17:46 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/executor/nodeSort.c,v 1.43 2003/05/05 17:57:47 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -137,7 +137,7 @@ ExecSort(SortState *node)
137137
"calling tuplesort_begin");
138138

139139
outerNode = outerPlanState(node);
140-
tupDesc = ExecGetTupType(outerNode);
140+
tupDesc = ExecGetResultType(outerNode);
141141

142142
ExtractSortKeys(plannode, &sortOperators, &attNums);
143143

@@ -173,11 +173,6 @@ ExecSort(SortState *node)
173173
*/
174174
estate->es_direction = dir;
175175

176-
/*
177-
* make sure the tuple descriptor is up to date (is this needed?)
178-
*/
179-
ExecAssignResultType(&node->ss.ps, tupDesc, false);
180-
181176
/*
182177
* finally set the sorted flag to true
183178
*/

src/include/executor/executor.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: executor.h,v 1.91 2003/03/11 19:40:23 tgl Exp $
10+
* $Id: executor.h,v 1.92 2003/05/05 17:57:47 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -101,7 +101,6 @@ extern PlanState *ExecInitNode(Plan *node, EState *estate);
101101
extern TupleTableSlot *ExecProcNode(PlanState *node);
102102
extern int ExecCountSlotsNode(Plan *node);
103103
extern void ExecEndNode(PlanState *node);
104-
extern TupleDesc ExecGetTupType(PlanState *node);
105104

106105
/*
107106
* prototypes from functions in execQual.c

0 commit comments

Comments
 (0)