27
27
*
28
28
*
29
29
* 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 $
31
31
*
32
32
*-------------------------------------------------------------------------
33
33
*/
@@ -62,14 +62,14 @@ static TupleTableSlot *ExecutePlan(EState *estate, Plan *plan,
62
62
long numberTuples ,
63
63
ScanDirection direction ,
64
64
DestReceiver * destfunc );
65
- static void ExecSelect (TupleTableSlot * slot ,
65
+ static void ExecRetrieve (TupleTableSlot * slot ,
66
66
DestReceiver * destfunc ,
67
67
EState * estate );
68
- static void ExecInsert (TupleTableSlot * slot ,ItemPointer tupleid ,
68
+ static void ExecAppend (TupleTableSlot * slot ,ItemPointer tupleid ,
69
69
EState * estate );
70
70
static void ExecDelete (TupleTableSlot * slot ,ItemPointer tupleid ,
71
71
EState * estate );
72
- static void ExecUpdate (TupleTableSlot * slot ,ItemPointer tupleid ,
72
+ static void ExecReplace (TupleTableSlot * slot ,ItemPointer tupleid ,
73
73
EState * estate );
74
74
static TupleTableSlot * EvalPlanQualNext (EState * estate );
75
75
static void EndEvalPlanQual (EState * estate );
@@ -251,7 +251,7 @@ ExecCheckQueryPerms(CmdType operation, Query *parseTree, Plan *plan)
251
251
ExecCheckRTPerms (parseTree -> rtable ,operation );
252
252
253
253
/*
254
- * Search for subplans andINSERT nodes to check their rangetables.
254
+ * Search for subplans andAPPEND nodes to check their rangetables.
255
255
*/
256
256
ExecCheckPlanPerms (plan ,parseTree -> rtable ,operation );
257
257
}
@@ -583,7 +583,7 @@ InitPlan(CmdType operation, Query *parseTree, Plan *plan, EState *estate)
583
583
/*
584
584
* Get the tuple descriptor describing the type of tuples to return.
585
585
* (this is especially important if we are creating a relation with
586
- * "SELECT INTO ")
586
+ * "retrieve into ")
587
587
*/
588
588
tupType = ExecGetTupType (plan );/* tuple descriptor */
589
589
@@ -892,7 +892,7 @@ EndPlan(Plan *plan, EState *estate)
892
892
*Retrieves all tuples if numberTuples is 0
893
893
*
894
894
*result is either a slot containing the last tuple in the case
895
- *of aSELECT or NULL otherwise.
895
+ *of aRETRIEVE or NULL otherwise.
896
896
*
897
897
* Note: the ctid attribute is a 'junk' attribute that is removed before the
898
898
* user can see it
@@ -1068,26 +1068,29 @@ lnext:;
1068
1068
1069
1069
slot = ExecStoreTuple (newTuple ,/* tuple to store */
1070
1070
junkfilter -> jf_resultSlot ,/* dest slot */
1071
- InvalidBuffer ,/* this tuple has no buffer */
1071
+ InvalidBuffer ,/* this tuple has no
1072
+ * buffer */
1072
1073
true);/* tuple should be pfreed */
1073
- }
1074
+ }/* if (junkfilter... */
1074
1075
1075
1076
/*
1076
1077
* now that we have a tuple, do the appropriate thing with it..
1077
1078
* either return it to the user, add it to a relation someplace,
1078
1079
* delete it from a relation, or modify some of its attributes.
1079
1080
*/
1081
+
1080
1082
switch (operation )
1081
1083
{
1082
1084
case 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 );/* */
1086
1089
result = slot ;
1087
1090
break ;
1088
1091
1089
1092
case CMD_INSERT :
1090
- ExecInsert (slot ,tupleid ,estate );
1093
+ ExecAppend (slot ,tupleid ,estate );
1091
1094
result = NULL ;
1092
1095
break ;
1093
1096
@@ -1097,7 +1100,7 @@ lnext:;
1097
1100
break ;
1098
1101
1099
1102
case CMD_UPDATE :
1100
- ExecUpdate (slot ,tupleid ,estate );
1103
+ ExecReplace (slot ,tupleid ,estate );
1101
1104
result = NULL ;
1102
1105
break ;
1103
1106
@@ -1118,25 +1121,25 @@ lnext:;
1118
1121
1119
1122
/*
1120
1123
* here, result is either a slot containing a tuple in the case of a
1121
- *SELECT or NULL otherwise.
1124
+ *RETRIEVE or NULL otherwise.
1122
1125
*/
1123
1126
return result ;
1124
1127
}
1125
1128
1126
1129
/* ----------------------------------------------------------------
1127
- *ExecSelect
1130
+ *ExecRetrieve
1128
1131
*
1129
- *SELECTs are easy.. we just pass the tuple to the appropriate
1132
+ *RETRIEVEs are easy.. we just pass the tuple to the appropriate
1130
1133
*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
1132
1135
*the appropriate relation (note: this is a newly created relation
1133
1136
*so we don't need to worry about indices or locks.)
1134
1137
* ----------------------------------------------------------------
1135
1138
*/
1136
1139
static void
1137
- ExecSelect (TupleTableSlot * slot ,
1138
- DestReceiver * destfunc ,
1139
- EState * estate )
1140
+ ExecRetrieve (TupleTableSlot * slot ,
1141
+ DestReceiver * destfunc ,
1142
+ EState * estate )
1140
1143
{
1141
1144
HeapTuple tuple ;
1142
1145
TupleDesc attrtype ;
@@ -1166,15 +1169,16 @@ ExecSelect(TupleTableSlot *slot,
1166
1169
}
1167
1170
1168
1171
/* ----------------------------------------------------------------
1169
- *ExecInsert
1172
+ *ExecAppend
1170
1173
*
1171
- *INSERTs are trickier.. we have to insert the tuple into
1174
+ *APPENDs are trickier.. we have to insert the tuple into
1172
1175
*the base relation and insert appropriate tuples into the
1173
1176
*index relations.
1174
1177
* ----------------------------------------------------------------
1175
1178
*/
1179
+
1176
1180
static void
1177
- ExecInsert (TupleTableSlot * slot ,
1181
+ ExecAppend (TupleTableSlot * slot ,
1178
1182
ItemPointer tupleid ,
1179
1183
EState * estate )
1180
1184
{
@@ -1223,7 +1227,7 @@ ExecInsert(TupleTableSlot *slot,
1223
1227
* Check the constraints of the tuple
1224
1228
*/
1225
1229
if (resultRelationDesc -> rd_att -> constr )
1226
- ExecConstraints ("ExecInsert " ,resultRelInfo ,slot ,estate );
1230
+ ExecConstraints ("ExecAppend " ,resultRelInfo ,slot ,estate );
1227
1231
1228
1232
/*
1229
1233
* insert the tuple
@@ -1255,7 +1259,7 @@ ExecInsert(TupleTableSlot *slot,
1255
1259
/* ----------------------------------------------------------------
1256
1260
*ExecDelete
1257
1261
*
1258
- *DELETE is likeUPDATE , we delete the tuple and its
1262
+ *DELETE is likeappend , we delete the tuple and its
1259
1263
*index tuples.
1260
1264
* ----------------------------------------------------------------
1261
1265
*/
@@ -1342,18 +1346,18 @@ ldelete:;
1342
1346
}
1343
1347
1344
1348
/* ----------------------------------------------------------------
1345
- *ExecUpdate
1349
+ *ExecReplace
1346
1350
*
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
1351
1355
*is, we don't want to get stuck in an infinite loop
1352
1356
*which corrupts your database..
1353
1357
* ----------------------------------------------------------------
1354
1358
*/
1355
1359
static void
1356
- ExecUpdate (TupleTableSlot * slot ,
1360
+ ExecReplace (TupleTableSlot * slot ,
1357
1361
ItemPointer tupleid ,
1358
1362
EState * estate )
1359
1363
{
@@ -1369,7 +1373,7 @@ ExecUpdate(TupleTableSlot *slot,
1369
1373
*/
1370
1374
if (IsBootstrapProcessingMode ())
1371
1375
{
1372
- elog (WARNING ,"ExecUpdate: UPDATE can't run without transactions" );
1376
+ elog (WARNING ,"ExecReplace: replace can't run without transactions" );
1373
1377
return ;
1374
1378
}
1375
1379
@@ -1420,7 +1424,7 @@ ExecUpdate(TupleTableSlot *slot,
1420
1424
*/
1421
1425
lreplace :;
1422
1426
if (resultRelationDesc -> rd_att -> constr )
1423
- ExecConstraints ("ExecUpdate " ,resultRelInfo ,slot ,estate );
1427
+ ExecConstraints ("ExecReplace " ,resultRelInfo ,slot ,estate );
1424
1428
1425
1429
/*
1426
1430
* replace the heap tuple
@@ -1468,7 +1472,7 @@ lreplace:;
1468
1472
/*
1469
1473
* Note: instead of having to update the old index tuples associated
1470
1474
* 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
1472
1476
* tuple deletion is done automagically by the vacuum daemon. All we
1473
1477
* do is insert new index tuples. -cim 9/27/89
1474
1478
*/
@@ -1477,7 +1481,7 @@ lreplace:;
1477
1481
* process indices
1478
1482
*
1479
1483
* 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,
1481
1485
* the tupleid of the new tuple is placed in the new tuple's t_ctid
1482
1486
* field. So we now insert index tuples using the new tupleid stored
1483
1487
* there.
@@ -1550,7 +1554,7 @@ ExecRelCheck(ResultRelInfo *resultRelInfo,
1550
1554
}
1551
1555
1552
1556
void
1553
- ExecConstraints (const char * caller ,ResultRelInfo * resultRelInfo ,
1557
+ ExecConstraints (char * caller ,ResultRelInfo * resultRelInfo ,
1554
1558
TupleTableSlot * slot ,EState * estate )
1555
1559
{
1556
1560
Relation rel = resultRelInfo -> ri_RelationDesc ;