26
26
*
27
27
*
28
28
* IDENTIFICATION
29
- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.19 1997/08/22 14:28:20 vadim Exp $
29
+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.20 1997/08/27 09:02:24 vadim Exp $
30
30
*
31
31
*-------------------------------------------------------------------------
32
32
*/
@@ -65,7 +65,7 @@ static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
65
65
int numberTuples , ScanDirection direction ,
66
66
void (* printfunc )());
67
67
static void ExecRetrieve (TupleTableSlot * slot , void (* printfunc )(),
68
- Relation intoRelationDesc );
68
+ EState * estate );
69
69
static void ExecAppend (TupleTableSlot * slot ,ItemPointer tupleid ,
70
70
EState * estate );
71
71
static void ExecDelete (TupleTableSlot * slot , ItemPointer tupleid ,
@@ -171,6 +171,8 @@ ExecutorRun(QueryDesc *queryDesc, EState *estate, int feature, int count)
171
171
plan = queryDesc -> plantree ;
172
172
dest = queryDesc -> dest ;
173
173
destination = (void (* )()) DestToFunction (dest );
174
+ estate -> es_processed = 0 ;
175
+ estate -> es_lastoid = InvalidOid ;
174
176
175
177
#if 0
176
178
/*
@@ -665,7 +667,6 @@ ExecutePlan(EState *estate,
665
667
ScanDirection direction ,
666
668
void (* printfunc )())
667
669
{
668
- Relation intoRelationDesc ;
669
670
JunkFilter * junkfilter ;
670
671
671
672
TupleTableSlot * slot ;
@@ -674,12 +675,6 @@ ExecutePlan(EState *estate,
674
675
int current_tuple_count ;
675
676
TupleTableSlot * result ;
676
677
677
- /* ----------------
678
- * get information
679
- * ----------------
680
- */
681
- intoRelationDesc = estate -> es_into_relation_descriptor ;
682
-
683
678
/* ----------------
684
679
* initialize local variables
685
680
* ----------------
@@ -780,9 +775,9 @@ ExecutePlan(EState *estate,
780
775
781
776
switch (operation ) {
782
777
case CMD_SELECT :
783
- ExecRetrieve (slot , /* slot containing tuple */
784
- printfunc , /* print function */
785
- intoRelationDesc ); /* "into" relation */
778
+ ExecRetrieve (slot , /* slot containing tuple */
779
+ printfunc , /* print function */
780
+ estate ); /* */
786
781
result = slot ;
787
782
break ;
788
783
@@ -853,7 +848,7 @@ ExecutePlan(EState *estate,
853
848
static void
854
849
ExecRetrieve (TupleTableSlot * slot ,
855
850
void (* printfunc )(),
856
- Relation intoRelationDesc )
851
+ EState * estate )
857
852
{
858
853
HeapTuple tuple ;
859
854
TupleDesc attrtype ;
@@ -869,9 +864,10 @@ ExecRetrieve(TupleTableSlot *slot,
869
864
* insert the tuple into the "into relation"
870
865
* ----------------
871
866
*/
872
- if (intoRelationDesc != NULL ) {
873
- heap_insert (intoRelationDesc , tuple );
874
- IncrAppended ();
867
+ if ( estate -> es_into_relation_descriptor != NULL )
868
+ {
869
+ heap_insert (estate -> es_into_relation_descriptor , tuple );
870
+ IncrAppended ();
875
871
}
876
872
877
873
/* ----------------
@@ -880,6 +876,7 @@ ExecRetrieve(TupleTableSlot *slot,
880
876
*/
881
877
(* printfunc )(tuple , attrtype );
882
878
IncrRetrieved ();
879
+ (estate -> es_processed )++ ;
883
880
}
884
881
885
882
/* ----------------------------------------------------------------
@@ -947,7 +944,6 @@ ExecAppend(TupleTableSlot *slot,
947
944
newId = heap_insert (resultRelationDesc , /* relation desc */
948
945
tuple ); /* heap tuple */
949
946
IncrAppended ();
950
- UpdateAppendOid (newId );
951
947
952
948
/* ----------------
953
949
* process indices
@@ -961,6 +957,8 @@ ExecAppend(TupleTableSlot *slot,
961
957
if (numIndices > 0 ) {
962
958
ExecInsertIndexTuples (slot , & (tuple -> t_ctid ), estate , false);
963
959
}
960
+ (estate -> es_processed )++ ;
961
+ estate -> es_lastoid = newId ;
964
962
}
965
963
966
964
/* ----------------------------------------------------------------
@@ -989,10 +987,12 @@ ExecDelete(TupleTableSlot *slot,
989
987
* delete the tuple
990
988
* ----------------
991
989
*/
992
- heap_delete (resultRelationDesc , /* relation desc */
993
- tupleid ); /* item pointer to tuple */
994
-
990
+ if ( heap_delete (resultRelationDesc , /* relation desc */
991
+ tupleid ) ) /* item pointer to tuple */
992
+ return ;
993
+
995
994
IncrDeleted ();
995
+ (estate -> es_processed )++ ;
996
996
997
997
/* ----------------
998
998
* Note: Normally one would think that we have to
@@ -1094,6 +1094,7 @@ ExecReplace(TupleTableSlot *slot,
1094
1094
}
1095
1095
1096
1096
IncrReplaced ();
1097
+ (estate -> es_processed )++ ;
1097
1098
1098
1099
/* ----------------
1099
1100
* Note: instead of having to update the old index tuples
0 commit comments