7
7
*
8
8
*
9
9
* IDENTIFICATION
10
- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.32 1998/08/19 02:01:05 momjian Exp $
10
+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.33 1998/08/20 22:07:30 momjian Exp $
11
11
*
12
12
*
13
13
* INTERFACE ROUTINES
@@ -1274,10 +1274,10 @@ heap_delete(Relation relation, ItemPointer tid)
1274
1274
* ----------------
1275
1275
*/
1276
1276
int
1277
- heap_replace (Relation relation , ItemPointer otid , HeapTuple tup )
1277
+ heap_replace (Relation relation , ItemPointer otid , HeapTuple replace_tuple )
1278
1278
{
1279
1279
ItemId lp ;
1280
- HeapTuple tp ;
1280
+ HeapTuple old_tuple ;
1281
1281
Page dp ;
1282
1282
Buffer buffer ;
1283
1283
HeapTuple tuple ;
@@ -1319,8 +1319,8 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
1319
1319
* ----------------
1320
1320
*/
1321
1321
1322
- tp = (HeapTuple ) PageGetItem (dp , lp );
1323
- Assert (HeapTupleIsValid (tp ));
1322
+ old_tuple = (HeapTuple ) PageGetItem (dp , lp );
1323
+ Assert (HeapTupleIsValid (old_tuple ));
1324
1324
1325
1325
/* -----------------
1326
1326
* the following test should be able to catch all non-functional
@@ -1333,7 +1333,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
1333
1333
* -----------------
1334
1334
*/
1335
1335
1336
- if (TupleUpdatedByCurXactAndCmd (tp ))
1336
+ if (TupleUpdatedByCurXactAndCmd (old_tuple ))
1337
1337
{
1338
1338
elog (NOTICE , "Non-functional update, only first update is performed" );
1339
1339
if (IsSystemRelationName (RelationGetRelationName (relation )-> data ))
@@ -1367,43 +1367,43 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
1367
1367
}
1368
1368
1369
1369
/* XXX order problems if not atomic assignment ??? */
1370
- tup -> t_oid = tp -> t_oid ;
1371
- TransactionIdStore (GetCurrentTransactionId (), & (tup -> t_xmin ));
1372
- tup -> t_cmin = GetCurrentCommandId ();
1373
- StoreInvalidTransactionId (& (tup -> t_xmax ));
1374
- tup -> t_infomask &= ~(HEAP_XACT_MASK );
1375
- tup -> t_infomask |= HEAP_XMAX_INVALID ;
1370
+ replace_tuple -> t_oid = old_tuple -> t_oid ;
1371
+ TransactionIdStore (GetCurrentTransactionId (), & (replace_tuple -> t_xmin ));
1372
+ replace_tuple -> t_cmin = GetCurrentCommandId ();
1373
+ StoreInvalidTransactionId (& (replace_tuple -> t_xmax ));
1374
+ replace_tuple -> t_infomask &= ~(HEAP_XACT_MASK );
1375
+ replace_tuple -> t_infomask |= HEAP_XMAX_INVALID ;
1376
1376
1377
1377
/* ----------------
1378
1378
* insert new item
1379
1379
* ----------------
1380
1380
*/
1381
- if ((unsigned ) DOUBLEALIGN (tup -> t_len ) <= PageGetFreeSpace ((Page ) dp ))
1382
- RelationPutHeapTuple (relation , BufferGetBlockNumber (buffer ), tup );
1381
+ if ((unsigned ) DOUBLEALIGN (replace_tuple -> t_len ) <= PageGetFreeSpace ((Page ) dp ))
1382
+ RelationPutHeapTuple (relation , BufferGetBlockNumber (buffer ), replace_tuple );
1383
1383
else
1384
1384
{
1385
1385
/* ----------------
1386
1386
* new item won't fit on same page as old item, have to look
1387
1387
* for a new place to put it.
1388
1388
* ----------------
1389
1389
*/
1390
- doinsert (relation , tup );
1390
+ doinsert (relation , replace_tuple );
1391
1391
}
1392
1392
1393
1393
/* ----------------
1394
1394
* new item in place, now record transaction information
1395
1395
* ----------------
1396
1396
*/
1397
- TransactionIdStore (GetCurrentTransactionId (), & (tp -> t_xmax ));
1398
- tp -> t_cmax = GetCurrentCommandId ();
1399
- tp -> t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID );
1397
+ TransactionIdStore (GetCurrentTransactionId (), & (old_tuple -> t_xmax ));
1398
+ old_tuple -> t_cmax = GetCurrentCommandId ();
1399
+ old_tuple -> t_infomask &= ~(HEAP_XMAX_COMMITTED | HEAP_XMAX_INVALID );
1400
1400
1401
1401
/* ----------------
1402
1402
* invalidate caches
1403
1403
* ----------------
1404
1404
*/
1405
1405
SetRefreshWhenInvalidate (ImmediateInvalidation );
1406
- RelationInvalidateHeapTuple (relation , tp );
1406
+ RelationInvalidateHeapTuple (relation , old_tuple );
1407
1407
SetRefreshWhenInvalidate ((bool ) !ImmediateInvalidation );
1408
1408
1409
1409
WriteBuffer (buffer );
0 commit comments