2727 *
2828 *
2929 * IDENTIFICATION
30- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.166 2002/06/25 17:27:20 momjian Exp $
30+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.167 2002/06/25 17:58:10 momjian Exp $
3131 *
3232 *-------------------------------------------------------------------------
3333 */
@@ -62,14 +62,14 @@ static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
6262long numberTuples ,
6363ScanDirection direction ,
6464DestReceiver * destfunc );
65- static void ExecSelect (TupleTableSlot * slot ,
65+ static void ExecRetrieve (TupleTableSlot * slot ,
6666DestReceiver * destfunc ,
6767EState * estate );
68- static void ExecInsert (TupleTableSlot * slot ,ItemPointer tupleid ,
68+ static void ExecAppend (TupleTableSlot * slot ,ItemPointer tupleid ,
6969EState * estate );
7070static void ExecDelete (TupleTableSlot * slot ,ItemPointer tupleid ,
7171EState * estate );
72- static void ExecUpdate (TupleTableSlot * slot ,ItemPointer tupleid ,
72+ static void ExecReplace (TupleTableSlot * slot ,ItemPointer tupleid ,
7373EState * estate );
7474static TupleTableSlot * EvalPlanQualNext (EState * estate );
7575static void EndEvalPlanQual (EState * estate );
@@ -251,7 +251,7 @@ ExecCheckQueryPerms(CmdType operation, Query *parseTree, Plan *plan)
251251ExecCheckRTPerms (parseTree -> rtable ,operation );
252252
253253/*
254- * Search for subplans andINSERT nodes to check their rangetables.
254+ * Search for subplans andAPPEND nodes to check their rangetables.
255255 */
256256ExecCheckPlanPerms (plan ,parseTree -> rtable ,operation );
257257}
@@ -583,7 +583,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
583583/*
584584 * Get the tuple descriptor describing the type of tuples to return.
585585 * (this is especially important if we are creating a relation with
586- * "SELECT INTO ")
586+ * "retrieve into ")
587587 */
588588tupType = ExecGetTupType (plan );/* tuple descriptor */
589589
@@ -892,7 +892,7 @@ EndPlan(Plan *plan, EState *estate)
892892 *Retrieves all tuples if numberTuples is 0
893893 *
894894 *result is either a slot containing the last tuple in the case
895- *of aSELECT or NULL otherwise.
895+ *of aRETRIEVE or NULL otherwise.
896896 *
897897 * Note: the ctid attribute is a 'junk' attribute that is removed before the
898898 * user can see it
@@ -1068,26 +1068,29 @@ lnext:;
10681068
10691069slot = ExecStoreTuple (newTuple ,/* tuple to store */
10701070junkfilter -> jf_resultSlot ,/* dest slot */
1071- InvalidBuffer ,/* this tuple has no buffer */
1071+ InvalidBuffer ,/* this tuple has no
1072+ * buffer */
10721073 true);/* tuple should be pfreed */
1073- }
1074+ }/* if (junkfilter... */
10741075
10751076/*
10761077 * now that we have a tuple, do the appropriate thing with it..
10771078 * either return it to the user, add it to a relation someplace,
10781079 * delete it from a relation, or modify some of its attributes.
10791080 */
1081+
10801082switch (operation )
10811083{
10821084case CMD_SELECT :
1083- ExecSelect (slot ,/* slot containing tuple */
1084- destfunc ,/* destination's tuple-receiver obj */
1085- estate );
1085+ ExecRetrieve (slot ,/* slot containing tuple */
1086+ destfunc ,/* destination's tuple-receiver
1087+ * obj */
1088+ estate );/* */
10861089result = slot ;
10871090break ;
10881091
10891092case CMD_INSERT :
1090- ExecInsert (slot ,tupleid ,estate );
1093+ ExecAppend (slot ,tupleid ,estate );
10911094result = NULL ;
10921095break ;
10931096
@@ -1097,7 +1100,7 @@ lnext:;
10971100break ;
10981101
10991102case CMD_UPDATE :
1100- ExecUpdate (slot ,tupleid ,estate );
1103+ ExecReplace (slot ,tupleid ,estate );
11011104result = NULL ;
11021105break ;
11031106
@@ -1118,25 +1121,25 @@ lnext:;
11181121
11191122/*
11201123 * here, result is either a slot containing a tuple in the case of a
1121- *SELECT or NULL otherwise.
1124+ *RETRIEVE or NULL otherwise.
11221125 */
11231126return result ;
11241127}
11251128
11261129/* ----------------------------------------------------------------
1127- *ExecSelect
1130+ *ExecRetrieve
11281131 *
1129- *SELECTs are easy.. we just pass the tuple to the appropriate
1132+ *RETRIEVEs are easy.. we just pass the tuple to the appropriate
11301133 *print function. The only complexity is when we do a
1131- *"SELECT INTO ", in which case we insert the tuple into
1134+ *"retrieve into ", in which case we insert the tuple into
11321135 *the appropriate relation (note: this is a newly created relation
11331136 *so we don't need to worry about indices or locks.)
11341137 * ----------------------------------------------------------------
11351138 */
11361139static void
1137- ExecSelect (TupleTableSlot * slot ,
1138- DestReceiver * destfunc ,
1139- EState * estate )
1140+ ExecRetrieve (TupleTableSlot * slot ,
1141+ DestReceiver * destfunc ,
1142+ EState * estate )
11401143{
11411144HeapTuple tuple ;
11421145TupleDesc attrtype ;
@@ -1166,15 +1169,16 @@ ExecSelect(TupleTableSlot *slot,
11661169}
11671170
11681171/* ----------------------------------------------------------------
1169- *ExecInsert
1172+ *ExecAppend
11701173 *
1171- *INSERTs are trickier.. we have to insert the tuple into
1174+ *APPENDs are trickier.. we have to insert the tuple into
11721175 *the base relation and insert appropriate tuples into the
11731176 *index relations.
11741177 * ----------------------------------------------------------------
11751178 */
1179+
11761180static void
1177- ExecInsert (TupleTableSlot * slot ,
1181+ ExecAppend (TupleTableSlot * slot ,
11781182ItemPointer tupleid ,
11791183EState * estate )
11801184{
@@ -1223,7 +1227,7 @@ ExecInsert(TupleTableSlot *slot,
12231227 * Check the constraints of the tuple
12241228 */
12251229if (resultRelationDesc -> rd_att -> constr )
1226- ExecConstraints ("ExecInsert " ,resultRelInfo ,slot ,estate );
1230+ ExecConstraints ("ExecAppend " ,resultRelInfo ,slot ,estate );
12271231
12281232/*
12291233 * insert the tuple
@@ -1255,7 +1259,7 @@ ExecInsert(TupleTableSlot *slot,
12551259/* ----------------------------------------------------------------
12561260 *ExecDelete
12571261 *
1258- *DELETE is likeUPDATE , we delete the tuple and its
1262+ *DELETE is likeappend , we delete the tuple and its
12591263 *index tuples.
12601264 * ----------------------------------------------------------------
12611265 */
@@ -1342,18 +1346,18 @@ ldelete:;
13421346}
13431347
13441348/* ----------------------------------------------------------------
1345- *ExecUpdate
1349+ *ExecReplace
13461350 *
1347- *note: we can't runUPDATE queries with transactions
1348- *off becauseUPDATEs are actuallyINSERTs and our
1349- *scan will mistakenly loop forever,updating the tuple
1350- *it justinserted ..This should be fixed but until it
1351+ *note: we can't runreplace queries with transactions
1352+ *off becausereplaces are actuallyappends and our
1353+ *scan will mistakenly loop forever,replacing the tuple
1354+ *it justappended ..This should be fixed but until it
13511355 *is, we don't want to get stuck in an infinite loop
13521356 *which corrupts your database..
13531357 * ----------------------------------------------------------------
13541358 */
13551359static void
1356- ExecUpdate (TupleTableSlot * slot ,
1360+ ExecReplace (TupleTableSlot * slot ,
13571361ItemPointer tupleid ,
13581362EState * estate )
13591363{
@@ -1369,7 +1373,7 @@ ExecUpdate(TupleTableSlot *slot,
13691373 */
13701374if (IsBootstrapProcessingMode ())
13711375{
1372- elog (WARNING ,"ExecUpdate: UPDATE can't run without transactions" );
1376+ elog (WARNING ,"ExecReplace: replace can't run without transactions" );
13731377return ;
13741378}
13751379
@@ -1420,7 +1424,7 @@ ExecUpdate(TupleTableSlot *slot,
14201424 */
14211425lreplace :;
14221426if (resultRelationDesc -> rd_att -> constr )
1423- ExecConstraints ("ExecUpdate " ,resultRelInfo ,slot ,estate );
1427+ ExecConstraints ("ExecReplace " ,resultRelInfo ,slot ,estate );
14241428
14251429/*
14261430 * replace the heap tuple
@@ -1468,7 +1472,7 @@ lreplace:;
14681472/*
14691473 * Note: instead of having to update the old index tuples associated
14701474 * with the heap tuple, all we do is form and insert new index tuples.
1471- * This is becauseUPDATEs are actuallyDELETEs andINSERTs and index
1475+ * This is becausereplaces are actuallydeletes andinserts and index
14721476 * tuple deletion is done automagically by the vacuum daemon. All we
14731477 * do is insert new index tuples. -cim 9/27/89
14741478 */
@@ -1477,7 +1481,7 @@ lreplace:;
14771481 * process indices
14781482 *
14791483 * heap_update updates a tuple in the base relation by invalidating it
1480- * and theninserting a new tuple to the relation.As a side effect,
1484+ * and thenappending a new tuple to the relation.As a side effect,
14811485 * the tupleid of the new tuple is placed in the new tuple's t_ctid
14821486 * field. So we now insert index tuples using the new tupleid stored
14831487 * there.
@@ -1550,7 +1554,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
15501554}
15511555
15521556void
1553- ExecConstraints (const char * caller ,ResultRelInfo * resultRelInfo ,
1557+ ExecConstraints (char * caller ,ResultRelInfo * resultRelInfo ,
15541558TupleTableSlot * slot ,EState * estate )
15551559{
15561560Relation rel = resultRelInfo -> ri_RelationDesc ;