77 *
88 *
99 * IDENTIFICATION
10- * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.21 1997/11/02 15:24:26 vadim Exp $
10+ * $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.22 1997/11/20 23:19:57 momjian Exp $
1111 *
1212 *
1313 * INTERFACE ROUTINES
@@ -215,7 +215,7 @@ heapgettup(Relation relation,
215215ItemPointer tid ,
216216int dir ,
217217Buffer * b ,
218- TimeQual timeQual ,
218+ bool seeself ,
219219int nkeys ,
220220ScanKey key )
221221{
@@ -254,19 +254,11 @@ heapgettup(Relation relation,
254254elog (DEBUG ,"heapgettup(%.16s, tid=0x%x, dir=%d, ...)" ,
255255RelationGetRelationName (relation ),tid ,dir );
256256}
257- elog (DEBUG ,"heapgettup(..., b=0x%x, timeQ=0x%x, nkeys=%d, key=0x%x" ,
258- b ,timeQual ,nkeys ,key );
259- if (timeQual == SelfTimeQual )
260- {
261- elog (DEBUG ,"heapgettup: relation(%c)=`%.16s', SelfTimeQual" ,
262- relation -> rd_rel -> relkind ,& relation -> rd_rel -> relname );
263- }
264- else
265- {
266- elog (DEBUG ,"heapgettup: relation(%c)=`%.16s', timeQual=%d" ,
267- relation -> rd_rel -> relkind ,& relation -> rd_rel -> relname ,
268- timeQual );
269- }
257+ elog (DEBUG ,"heapgettup(..., b=0x%x, nkeys=%d, key=0x%x" ,b ,nkeys ,key );
258+
259+ elog (DEBUG ,"heapgettup: relation(%c)=`%.16s', %s" ,
260+ relation -> rd_rel -> relkind ,& relation -> rd_rel -> relname ,
261+ (seeself == true) ?"SeeSelf" :"NoSeeSelf" );
270262#endif /* !defined(HEAPDEBUGALL) */
271263
272264if (!ItemPointerIsValid (tid ))
@@ -303,9 +295,7 @@ heapgettup(Relation relation,
303295
304296#ifndef NO_BUFFERISVALID
305297if (!BufferIsValid (* b ))
306- {
307298elog (WARN ,"heapgettup: failed ReadBuffer" );
308- }
309299#endif
310300
311301dp = (Page )BufferGetPage (* b );
@@ -430,7 +420,7 @@ heapgettup(Relation relation,
430420 * ----------------
431421 */
432422HeapTupleSatisfies (lpp ,relation ,* b , (PageHeader )dp ,
433- timeQual ,nkeys ,key ,rtup );
423+ seeself ,nkeys ,key ,rtup );
434424if (rtup != NULL )
435425{
436426ItemPointer iptr = & (rtup -> t_ctid );
@@ -618,7 +608,7 @@ heap_close(Relation relation)
618608HeapScanDesc
619609heap_beginscan (Relation relation ,
620610int atend ,
621- TimeQual timeQual ,
611+ bool seeself ,
622612unsigned nkeys ,
623613ScanKey key )
624614{
@@ -646,9 +636,7 @@ heap_beginscan(Relation relation,
646636
647637/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
648638if (relation -> rd_rel -> relkind == RELKIND_UNCATALOGED )
649- {
650- timeQual = SelfTimeQual ;
651- }
639+ seeself = true;
652640
653641/* ----------------
654642 *increment relation ref count while scanning relation
@@ -666,24 +654,19 @@ heap_beginscan(Relation relation,
666654sdesc -> rs_rd = relation ;
667655
668656if (nkeys )
669- {
670-
671657/*
672658 * we do this here instead of in initsdesc() because heap_rescan
673659 * also calls initsdesc() and we don't want to allocate memory
674660 * again
675661 */
676662sdesc -> rs_key = (ScanKey )palloc (sizeof (ScanKeyData )* nkeys );
677- }
678663else
679- {
680664sdesc -> rs_key = NULL ;
681- }
682665
683666initsdesc (sdesc ,relation ,atend ,nkeys ,key );
684667
685668sdesc -> rs_atend = atend ;
686- sdesc -> rs_tr = timeQual ;
669+ sdesc -> rs_seeself = seeself ;
687670sdesc -> rs_nkeys = (short )nkeys ;
688671
689672return (sdesc );
@@ -900,7 +883,7 @@ heap_getnext(HeapScanDesc scandesc,
900883iptr ,
901884-1 ,
902885& (sdesc -> rs_cbuf ),
903- sdesc -> rs_tr ,
886+ sdesc -> rs_seeself ,
904887sdesc -> rs_nkeys ,
905888sdesc -> rs_key );
906889}
@@ -987,7 +970,7 @@ heap_getnext(HeapScanDesc scandesc,
987970iptr ,
9889711 ,
989972& sdesc -> rs_cbuf ,
990- sdesc -> rs_tr ,
973+ sdesc -> rs_seeself ,
991974sdesc -> rs_nkeys ,
992975sdesc -> rs_key );
993976}
@@ -1032,7 +1015,7 @@ heap_getnext(HeapScanDesc scandesc,
10321015 */
10331016HeapTuple
10341017heap_fetch (Relation relation ,
1035- TimeQual timeQual ,
1018+ bool seeself ,
10361019ItemPointer tid ,
10371020Buffer * b )
10381021{
@@ -1094,7 +1077,7 @@ heap_fetch(Relation relation,
10941077 */
10951078
10961079HeapTupleSatisfies (lp ,relation ,buffer ,dp ,
1097- timeQual ,0 , (ScanKey )NULL ,tuple );
1080+ seeself ,0 , (ScanKey )NULL ,tuple );
10981081
10991082if (tuple == NULL )
11001083{
@@ -1259,7 +1242,7 @@ heap_delete(Relation relation, ItemPointer tid)
12591242 * ----------------
12601243 */
12611244HeapTupleSatisfies (lp ,relation ,b ,dp ,
1262- NowTimeQual ,0 , (ScanKey )NULL ,tp );
1245+ false ,0 , (ScanKey )NULL ,tp );
12631246if (!tp )
12641247{
12651248
@@ -1395,7 +1378,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
13951378relation ,
13961379buffer ,
13971380 (PageHeader )dp ,
1398- NowTimeQual ,
1381+ false ,
139913820 ,
14001383 (ScanKey )NULL ,
14011384tuple );
@@ -1492,7 +1475,7 @@ heap_markpos(HeapScanDesc sdesc)
14921475 (ItemPointer )NULL :& sdesc -> rs_ctup -> t_ctid ,
14931476-1 ,
14941477& sdesc -> rs_pbuf ,
1495- sdesc -> rs_tr ,
1478+ sdesc -> rs_seeself ,
14961479sdesc -> rs_nkeys ,
14971480sdesc -> rs_key );
14981481
@@ -1506,7 +1489,7 @@ heap_markpos(HeapScanDesc sdesc)
15061489 (ItemPointer )NULL :& sdesc -> rs_ctup -> t_ctid ,
150714901 ,
15081491& sdesc -> rs_nbuf ,
1509- sdesc -> rs_tr ,
1492+ sdesc -> rs_seeself ,
15101493sdesc -> rs_nkeys ,
15111494sdesc -> rs_key );
15121495}
@@ -1594,7 +1577,7 @@ heap_restrpos(HeapScanDesc sdesc)
15941577& sdesc -> rs_mptid ,
159515780 ,
15961579& sdesc -> rs_pbuf ,
1597- NowTimeQual ,
1580+ false ,
159815810 ,
15991582 (ScanKey )NULL );
16001583}
@@ -1610,7 +1593,7 @@ heap_restrpos(HeapScanDesc sdesc)
16101593& sdesc -> rs_mctid ,
161115940 ,
16121595& sdesc -> rs_cbuf ,
1613- NowTimeQual ,
1596+ false ,
161415970 ,
16151598 (ScanKey )NULL );
16161599}
@@ -1626,7 +1609,7 @@ heap_restrpos(HeapScanDesc sdesc)
16261609& sdesc -> rs_mntid ,
162716100 ,
16281611& sdesc -> rs_nbuf ,
1629- NowTimeQual ,
1612+ false ,
163016130 ,
16311614 (ScanKey )NULL );
16321615}