2727 *
2828 *
2929 * IDENTIFICATION
30- * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.165 2002/06/20 20:29:27 momjian Exp $
30+ * $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.166 2002/06/25 17:27:20 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 ExecRetrieve (TupleTableSlot * slot ,
65+ static void ExecSelect (TupleTableSlot * slot ,
6666DestReceiver * destfunc ,
6767EState * estate );
68- static void ExecAppend (TupleTableSlot * slot ,ItemPointer tupleid ,
68+ static void ExecInsert (TupleTableSlot * slot ,ItemPointer tupleid ,
6969EState * estate );
7070static void ExecDelete (TupleTableSlot * slot ,ItemPointer tupleid ,
7171EState * estate );
72- static void ExecReplace (TupleTableSlot * slot ,ItemPointer tupleid ,
72+ static void ExecUpdate (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 andAPPEND nodes to check their rangetables.
254+ * Search for subplans andINSERT 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- * "retrieve into ")
586+ * "SELECT 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 aRETRIEVE or NULL otherwise.
895+ *of aSELECT or NULL otherwise.
896896 *
897897 * Note: the ctid attribute is a 'junk' attribute that is removed before the
898898 * user can see it
@@ -1068,29 +1068,26 @@ lnext:;
10681068
10691069slot = ExecStoreTuple (newTuple ,/* tuple to store */
10701070junkfilter -> jf_resultSlot ,/* dest slot */
1071- InvalidBuffer ,/* this tuple has no
1072- * buffer */
1071+ InvalidBuffer ,/* this tuple has no buffer */
10731072 true);/* tuple should be pfreed */
1074- }/* if (junkfilter... */
1073+ }
10751074
10761075/*
10771076 * now that we have a tuple, do the appropriate thing with it..
10781077 * either return it to the user, add it to a relation someplace,
10791078 * delete it from a relation, or modify some of its attributes.
10801079 */
1081-
10821080switch (operation )
10831081{
10841082case CMD_SELECT :
1085- ExecRetrieve (slot ,/* slot containing tuple */
1086- destfunc ,/* destination's tuple-receiver
1087- * obj */
1088- estate );/* */
1083+ ExecSelect (slot ,/* slot containing tuple */
1084+ destfunc ,/* destination's tuple-receiver obj */
1085+ estate );
10891086result = slot ;
10901087break ;
10911088
10921089case CMD_INSERT :
1093- ExecAppend (slot ,tupleid ,estate );
1090+ ExecInsert (slot ,tupleid ,estate );
10941091result = NULL ;
10951092break ;
10961093
@@ -1100,7 +1097,7 @@ lnext:;
11001097break ;
11011098
11021099case CMD_UPDATE :
1103- ExecReplace (slot ,tupleid ,estate );
1100+ ExecUpdate (slot ,tupleid ,estate );
11041101result = NULL ;
11051102break ;
11061103
@@ -1121,25 +1118,25 @@ lnext:;
11211118
11221119/*
11231120 * here, result is either a slot containing a tuple in the case of a
1124- *RETRIEVE or NULL otherwise.
1121+ *SELECT or NULL otherwise.
11251122 */
11261123return result ;
11271124}
11281125
11291126/* ----------------------------------------------------------------
1130- *ExecRetrieve
1127+ *ExecSelect
11311128 *
1132- *RETRIEVEs are easy.. we just pass the tuple to the appropriate
1129+ *SELECTs are easy.. we just pass the tuple to the appropriate
11331130 *print function. The only complexity is when we do a
1134- *"retrieve into ", in which case we insert the tuple into
1131+ *"SELECT INTO ", in which case we insert the tuple into
11351132 *the appropriate relation (note: this is a newly created relation
11361133 *so we don't need to worry about indices or locks.)
11371134 * ----------------------------------------------------------------
11381135 */
11391136static void
1140- ExecRetrieve (TupleTableSlot * slot ,
1141- DestReceiver * destfunc ,
1142- EState * estate )
1137+ ExecSelect (TupleTableSlot * slot ,
1138+ DestReceiver * destfunc ,
1139+ EState * estate )
11431140{
11441141HeapTuple tuple ;
11451142TupleDesc attrtype ;
@@ -1169,16 +1166,15 @@ ExecRetrieve(TupleTableSlot *slot,
11691166}
11701167
11711168/* ----------------------------------------------------------------
1172- *ExecAppend
1169+ *ExecInsert
11731170 *
1174- *APPENDs are trickier.. we have to insert the tuple into
1171+ *INSERTs are trickier.. we have to insert the tuple into
11751172 *the base relation and insert appropriate tuples into the
11761173 *index relations.
11771174 * ----------------------------------------------------------------
11781175 */
1179-
11801176static void
1181- ExecAppend (TupleTableSlot * slot ,
1177+ ExecInsert (TupleTableSlot * slot ,
11821178ItemPointer tupleid ,
11831179EState * estate )
11841180{
@@ -1227,7 +1223,7 @@ ExecAppend(TupleTableSlot *slot,
12271223 * Check the constraints of the tuple
12281224 */
12291225if (resultRelationDesc -> rd_att -> constr )
1230- ExecConstraints ("ExecAppend " ,resultRelInfo ,slot ,estate );
1226+ ExecConstraints ("ExecInsert " ,resultRelInfo ,slot ,estate );
12311227
12321228/*
12331229 * insert the tuple
@@ -1259,7 +1255,7 @@ ExecAppend(TupleTableSlot *slot,
12591255/* ----------------------------------------------------------------
12601256 *ExecDelete
12611257 *
1262- *DELETE is likeappend , we delete the tuple and its
1258+ *DELETE is likeUPDATE , we delete the tuple and its
12631259 *index tuples.
12641260 * ----------------------------------------------------------------
12651261 */
@@ -1346,18 +1342,18 @@ ldelete:;
13461342}
13471343
13481344/* ----------------------------------------------------------------
1349- *ExecReplace
1345+ *ExecUpdate
13501346 *
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
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
13551351 *is, we don't want to get stuck in an infinite loop
13561352 *which corrupts your database..
13571353 * ----------------------------------------------------------------
13581354 */
13591355static void
1360- ExecReplace (TupleTableSlot * slot ,
1356+ ExecUpdate (TupleTableSlot * slot ,
13611357ItemPointer tupleid ,
13621358EState * estate )
13631359{
@@ -1373,7 +1369,7 @@ ExecReplace(TupleTableSlot *slot,
13731369 */
13741370if (IsBootstrapProcessingMode ())
13751371{
1376- elog (WARNING ,"ExecReplace: replace can't run without transactions" );
1372+ elog (WARNING ,"ExecUpdate: UPDATE can't run without transactions" );
13771373return ;
13781374}
13791375
@@ -1424,7 +1420,7 @@ ExecReplace(TupleTableSlot *slot,
14241420 */
14251421lreplace :;
14261422if (resultRelationDesc -> rd_att -> constr )
1427- ExecConstraints ("ExecReplace " ,resultRelInfo ,slot ,estate );
1423+ ExecConstraints ("ExecUpdate " ,resultRelInfo ,slot ,estate );
14281424
14291425/*
14301426 * replace the heap tuple
@@ -1472,7 +1468,7 @@ lreplace:;
14721468/*
14731469 * Note: instead of having to update the old index tuples associated
14741470 * with the heap tuple, all we do is form and insert new index tuples.
1475- * This is becausereplaces are actuallydeletes andinserts and index
1471+ * This is becauseUPDATEs are actuallyDELETEs andINSERTs and index
14761472 * tuple deletion is done automagically by the vacuum daemon. All we
14771473 * do is insert new index tuples. -cim 9/27/89
14781474 */
@@ -1481,7 +1477,7 @@ lreplace:;
14811477 * process indices
14821478 *
14831479 * heap_update updates a tuple in the base relation by invalidating it
1484- * and thenappending a new tuple to the relation.As a side effect,
1480+ * and theninserting a new tuple to the relation.As a side effect,
14851481 * the tupleid of the new tuple is placed in the new tuple's t_ctid
14861482 * field. So we now insert index tuples using the new tupleid stored
14871483 * there.
@@ -1554,7 +1550,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
15541550}
15551551
15561552void
1557- ExecConstraints (char * caller ,ResultRelInfo * resultRelInfo ,
1553+ ExecConstraints (const char * caller ,ResultRelInfo * resultRelInfo ,
15581554TupleTableSlot * slot ,EState * estate )
15591555{
15601556Relation rel = resultRelInfo -> ri_RelationDesc ;