Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitffb087c

Browse files
committed
This patch refactors execTuples.c in two ways.
Neil Conway
1 parent8f61184 commitffb087c

File tree

1 file changed

+26
-62
lines changed

1 file changed

+26
-62
lines changed

‎src/backend/executor/execTuples.c

Lines changed: 26 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*
1616
*
1717
* IDENTIFICATION
18-
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.73 2003/11/29 19:51:48 pgsql Exp $
18+
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.74 2003/12/01 23:09:02 momjian Exp $
1919
*
2020
*-------------------------------------------------------------------------
2121
*/
@@ -112,6 +112,8 @@
112112
#include"executor/executor.h"
113113
#include"utils/lsyscache.h"
114114

115+
staticTupleDescExecTypeFromTLInternal(List*targetList,
116+
boolhasoid,boolskipjunk);
115117

116118
/* ----------------------------------------------------------------
117119
* tuple table create/delete functions
@@ -469,13 +471,6 @@ ExecSetSlotDescriptorIsNew(TupleTableSlot *slot,/* slot to change */
469471
*is used for initializing special-purpose slots.
470472
* --------------------------------
471473
*/
472-
#defineINIT_SLOT_DEFS \
473-
TupleTable tupleTable; \
474-
TupleTableSlot* slot
475-
476-
#defineINIT_SLOT_ALLOC \
477-
tupleTable = (TupleTable) estate->es_tupleTable; \
478-
slot = ExecAllocTableSlot(tupleTable);
479474

480475
/* ----------------
481476
*ExecInitResultTupleSlot
@@ -484,9 +479,7 @@ ExecSetSlotDescriptorIsNew(TupleTableSlot *slot,/* slot to change */
484479
void
485480
ExecInitResultTupleSlot(EState*estate,PlanState*planstate)
486481
{
487-
INIT_SLOT_DEFS;
488-
INIT_SLOT_ALLOC;
489-
planstate->ps_ResultTupleSlot=slot;
482+
planstate->ps_ResultTupleSlot=ExecAllocTableSlot(estate->es_tupleTable);
490483
}
491484

492485
/* ----------------
@@ -496,9 +489,7 @@ ExecInitResultTupleSlot(EState *estate, PlanState *planstate)
496489
void
497490
ExecInitScanTupleSlot(EState*estate,ScanState*scanstate)
498491
{
499-
INIT_SLOT_DEFS;
500-
INIT_SLOT_ALLOC;
501-
scanstate->ss_ScanTupleSlot=slot;
492+
scanstate->ss_ScanTupleSlot=ExecAllocTableSlot(estate->es_tupleTable);
502493
}
503494

504495
/* ----------------
@@ -508,9 +499,7 @@ ExecInitScanTupleSlot(EState *estate, ScanState *scanstate)
508499
TupleTableSlot*
509500
ExecInitExtraTupleSlot(EState*estate)
510501
{
511-
INIT_SLOT_DEFS;
512-
INIT_SLOT_ALLOC;
513-
returnslot;
502+
returnExecAllocTableSlot(estate->es_tupleTable);
514503
}
515504

516505
/* ----------------
@@ -560,34 +549,7 @@ ExecInitNullTupleSlot(EState *estate, TupleDesc tupType)
560549
TupleDesc
561550
ExecTypeFromTL(List*targetList,boolhasoid)
562551
{
563-
TupleDesctypeInfo;
564-
List*tlitem;
565-
intlen;
566-
567-
/*
568-
* allocate a new typeInfo
569-
*/
570-
len=ExecTargetListLength(targetList);
571-
typeInfo=CreateTemplateTupleDesc(len,hasoid);
572-
573-
/*
574-
* scan list, generate type info for each entry
575-
*/
576-
foreach(tlitem,targetList)
577-
{
578-
TargetEntry*tle=lfirst(tlitem);
579-
Resdom*resdom=tle->resdom;
580-
581-
TupleDescInitEntry(typeInfo,
582-
resdom->resno,
583-
resdom->resname,
584-
resdom->restype,
585-
resdom->restypmod,
586-
0,
587-
false);
588-
}
589-
590-
returntypeInfo;
552+
returnExecTypeFromTLInternal(targetList,hasoid, false);
591553
}
592554

593555
/* ----------------------------------------------------------------
@@ -599,30 +561,32 @@ ExecTypeFromTL(List *targetList, bool hasoid)
599561
TupleDesc
600562
ExecCleanTypeFromTL(List*targetList,boolhasoid)
601563
{
602-
TupleDesctypeInfo;
603-
List*tlitem;
604-
intlen;
605-
intcleanresno;
564+
returnExecTypeFromTLInternal(targetList,hasoid, true);
565+
}
606566

607-
/*
608-
* allocate a new typeInfo
609-
*/
610-
len=ExecCleanTargetListLength(targetList);
567+
staticTupleDesc
568+
ExecTypeFromTLInternal(List*targetList,boolhasoid,boolskipjunk)
569+
{
570+
TupleDesctypeInfo;
571+
List*l;
572+
intlen;
573+
intcur_resno=1;
574+
575+
if (skipjunk)
576+
len=ExecCleanTargetListLength(targetList);
577+
else
578+
len=ExecTargetListLength(targetList);
611579
typeInfo=CreateTemplateTupleDesc(len,hasoid);
612580

613-
/*
614-
* scan list, generate type info for each entry
615-
*/
616-
cleanresno=1;
617-
foreach(tlitem,targetList)
581+
foreach(l,targetList)
618582
{
619-
TargetEntry*tle=lfirst(tlitem);
620-
Resdom*resdom=tle->resdom;
583+
TargetEntry*tle=lfirst(l);
584+
Resdom*resdom=tle->resdom;
621585

622-
if (resdom->resjunk)
586+
if (skipjunk&&resdom->resjunk)
623587
continue;
624588
TupleDescInitEntry(typeInfo,
625-
cleanresno++,
589+
cur_resno++,
626590
resdom->resname,
627591
resdom->restype,
628592
resdom->restypmod,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp