diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c
index f39b49ce72073a1d237c3a904768bd3cfa0503c5..e9ea3041b753e7c89b92f20bdb86c1ee2675409a 100644
--- a/src/backend/access/gist/gist.c
+++ b/src/backend/access/gist/gist.c
@@ -169,7 +169,7 @@ gistbuild(Relation heap,
 		econtext = NULL;
 	}
 #endif							/* OMIT_PARTIAL_INDEX */
-	scan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+	scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
 	htup = heap_getnext(scan, 0, &buffer);
 
 	/* int the tuples as we insert them */
diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c
index 93ae2885378f92f8c0e4bf646c91fe7bcd1a516c..bcfe5fdfc8a714d7192ad02330d26508baf326fa 100644
--- a/src/backend/access/hash/hash.c
+++ b/src/backend/access/hash/hash.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.16 1997/09/08 21:40:45 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.17 1997/11/20 23:19:50 momjian Exp $
  *
  * NOTES
  *	  This file contains only the public interface routines.
@@ -121,7 +121,7 @@ hashbuild(Relation heap,
 #endif							/* OMIT_PARTIAL_INDEX */
 
 	/* start a heap scan */
-	hscan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+	hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
 	htup = heap_getnext(hscan, 0, &buffer);
 
 	/* build the index */
diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c
index cc173f4fe8b76224ac2ecc6c593a62da2d66bca0..53fd3f882d970ae83becf4ec12942f56d711d539 100644
--- a/src/backend/access/heap/heapam.c
+++ b/src/backend/access/heap/heapam.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.21 1997/11/02 15:24:26 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/heap/heapam.c,v 1.22 1997/11/20 23:19:57 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -215,7 +215,7 @@ heapgettup(Relation relation,
 		   ItemPointer tid,
 		   int dir,
 		   Buffer *b,
-		   TimeQual timeQual,
+		   bool seeself,
 		   int nkeys,
 		   ScanKey key)
 {
@@ -254,19 +254,11 @@ heapgettup(Relation relation,
 		elog(DEBUG, "heapgettup(%.16s, tid=0x%x, dir=%d, ...)",
 			 RelationGetRelationName(relation), tid, dir);
 	}
-	elog(DEBUG, "heapgettup(..., b=0x%x, timeQ=0x%x, nkeys=%d, key=0x%x",
-		 b, timeQual, nkeys, key);
-	if (timeQual == SelfTimeQual)
-	{
-		elog(DEBUG, "heapgettup: relation(%c)=`%.16s', SelfTimeQual",
-			 relation->rd_rel->relkind, &relation->rd_rel->relname);
-	}
-	else
-	{
-		elog(DEBUG, "heapgettup: relation(%c)=`%.16s', timeQual=%d",
-			 relation->rd_rel->relkind, &relation->rd_rel->relname,
-			 timeQual);
-	}
+	elog(DEBUG, "heapgettup(..., b=0x%x, nkeys=%d, key=0x%x", b, nkeys, key);
+
+	elog(DEBUG, "heapgettup: relation(%c)=`%.16s', %s",
+		 relation->rd_rel->relkind, &relation->rd_rel->relname,
+		 (seeself == true) ? "SeeSelf" : "NoSeeSelf");
 #endif							/* !defined(HEAPDEBUGALL) */
 
 	if (!ItemPointerIsValid(tid))
@@ -303,9 +295,7 @@ heapgettup(Relation relation,
 
 #ifndef NO_BUFFERISVALID
 		if (!BufferIsValid(*b))
-		{
 			elog(WARN, "heapgettup: failed ReadBuffer");
-		}
 #endif
 
 		dp = (Page) BufferGetPage(*b);
@@ -430,7 +420,7 @@ heapgettup(Relation relation,
 			 * ----------------
 			 */
 			HeapTupleSatisfies(lpp, relation, *b, (PageHeader) dp,
-							   timeQual, nkeys, key, rtup);
+							   seeself, nkeys, key, rtup);
 			if (rtup != NULL)
 			{
 				ItemPointer iptr = &(rtup->t_ctid);
@@ -618,7 +608,7 @@ heap_close(Relation relation)
 HeapScanDesc
 heap_beginscan(Relation relation,
 			   int atend,
-			   TimeQual timeQual,
+			   bool seeself,
 			   unsigned nkeys,
 			   ScanKey key)
 {
@@ -646,9 +636,7 @@ heap_beginscan(Relation relation,
 
 	/* XXX someday assert SelfTimeQual if relkind == RELKIND_UNCATALOGED */
 	if (relation->rd_rel->relkind == RELKIND_UNCATALOGED)
-	{
-		timeQual = SelfTimeQual;
-	}
+		seeself = true;
 
 	/* ----------------
 	 *	increment relation ref count while scanning relation
@@ -666,24 +654,19 @@ heap_beginscan(Relation relation,
 	sdesc->rs_rd = relation;
 
 	if (nkeys)
-	{
-
 		/*
 		 * we do this here instead of in initsdesc() because heap_rescan
 		 * also calls initsdesc() and we don't want to allocate memory
 		 * again
 		 */
 		sdesc->rs_key = (ScanKey) palloc(sizeof(ScanKeyData) * nkeys);
-	}
 	else
-	{
 		sdesc->rs_key = NULL;
-	}
 
 	initsdesc(sdesc, relation, atend, nkeys, key);
 
 	sdesc->rs_atend = atend;
-	sdesc->rs_tr = timeQual;
+	sdesc->rs_seeself = seeself;
 	sdesc->rs_nkeys = (short) nkeys;
 
 	return (sdesc);
@@ -900,7 +883,7 @@ heap_getnext(HeapScanDesc scandesc,
 						   iptr,
 						   -1,
 						   &(sdesc->rs_cbuf),
-						   sdesc->rs_tr,
+						   sdesc->rs_seeself,
 						   sdesc->rs_nkeys,
 						   sdesc->rs_key);
 		}
@@ -987,7 +970,7 @@ heap_getnext(HeapScanDesc scandesc,
 						   iptr,
 						   1,
 						   &sdesc->rs_cbuf,
-						   sdesc->rs_tr,
+						   sdesc->rs_seeself,
 						   sdesc->rs_nkeys,
 						   sdesc->rs_key);
 		}
@@ -1032,7 +1015,7 @@ heap_getnext(HeapScanDesc scandesc,
  */
 HeapTuple
 heap_fetch(Relation relation,
-		   TimeQual timeQual,
+		   bool seeself,
 		   ItemPointer tid,
 		   Buffer *b)
 {
@@ -1094,7 +1077,7 @@ heap_fetch(Relation relation,
 	 */
 
 	HeapTupleSatisfies(lp, relation, buffer, dp,
-					   timeQual, 0, (ScanKey) NULL, tuple);
+					   seeself, 0, (ScanKey) NULL, tuple);
 
 	if (tuple == NULL)
 	{
@@ -1259,7 +1242,7 @@ heap_delete(Relation relation, ItemPointer tid)
 	 * ----------------
 	 */
 	HeapTupleSatisfies(lp, relation, b, dp,
-					   NowTimeQual, 0, (ScanKey) NULL, tp);
+					   false, 0, (ScanKey) NULL, tp);
 	if (!tp)
 	{
 
@@ -1395,7 +1378,7 @@ heap_replace(Relation relation, ItemPointer otid, HeapTuple tup)
 						 relation,
 						 buffer,
 						 (PageHeader) dp,
-						 NowTimeQual,
+						 false,
 						 0,
 						 (ScanKey) NULL,
 						 tuple);
@@ -1492,7 +1475,7 @@ heap_markpos(HeapScanDesc sdesc)
 					   (ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
 					   -1,
 					   &sdesc->rs_pbuf,
-					   sdesc->rs_tr,
+					   sdesc->rs_seeself,
 					   sdesc->rs_nkeys,
 					   sdesc->rs_key);
 
@@ -1506,7 +1489,7 @@ heap_markpos(HeapScanDesc sdesc)
 					   (ItemPointer) NULL : &sdesc->rs_ctup->t_ctid,
 					   1,
 					   &sdesc->rs_nbuf,
-					   sdesc->rs_tr,
+					   sdesc->rs_seeself,
 					   sdesc->rs_nkeys,
 					   sdesc->rs_key);
 	}
@@ -1594,7 +1577,7 @@ heap_restrpos(HeapScanDesc sdesc)
 					   &sdesc->rs_mptid,
 					   0,
 					   &sdesc->rs_pbuf,
-					   NowTimeQual,
+					   false,
 					   0,
 					   (ScanKey) NULL);
 	}
@@ -1610,7 +1593,7 @@ heap_restrpos(HeapScanDesc sdesc)
 					   &sdesc->rs_mctid,
 					   0,
 					   &sdesc->rs_cbuf,
-					   NowTimeQual,
+					   false,
 					   0,
 					   (ScanKey) NULL);
 	}
@@ -1626,7 +1609,7 @@ heap_restrpos(HeapScanDesc sdesc)
 					   &sdesc->rs_mntid,
 					   0,
 					   &sdesc->rs_nbuf,
-					   NowTimeQual,
+					   false,
 					   0,
 					   (ScanKey) NULL);
 	}
diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c
index d47ceed6d6a7e41e872f768f4cbf18180003ead7..36693592c46b400b07609d3332dcab76376f747e 100644
--- a/src/backend/access/index/istrat.c
+++ b/src/backend/access/index/istrat.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.12 1997/09/08 21:41:07 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.13 1997/11/20 23:20:07 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -508,7 +508,7 @@ OperatorRelationFillScanKeyEntry(Relation operatorRelation,
 						   ObjectIdEqualRegProcedure,
 						   ObjectIdGetDatum(operatorObjectId));
 
-	scan = heap_beginscan(operatorRelation, false, NowTimeQual,
+	scan = heap_beginscan(operatorRelation, false, false,
 						  1, &scanKeyData);
 
 	tuple = heap_getnext(scan, false, (Buffer *) NULL);
@@ -564,7 +564,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
 						   ObjectIdGetDatum(indexObjectId));
 
 	relation = heap_openr(IndexRelationName);
-	scan = heap_beginscan(relation, false, NowTimeQual, 1, entry);
+	scan = heap_beginscan(relation, false, false, 1, entry);
 	tuple = heap_getnext(scan, 0, (Buffer *) NULL);
 	if (!HeapTupleIsValid(tuple))
 		elog(WARN, "IndexSupportInitialize: corrupted catalogs");
@@ -628,7 +628,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
 			entry[1].sk_argument =
 				ObjectIdGetDatum(operatorClassObjectId[attributeNumber - 1]);
 
-			scan = heap_beginscan(relation, false, NowTimeQual, 2, entry);
+			scan = heap_beginscan(relation, false, false, 2, entry);
 
 			while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
 				   HeapTupleIsValid(tuple))
@@ -671,7 +671,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
 		for (strategy = 1; strategy <= maxStrategyNumber; strategy++)
 			ScanKeyEntrySetIllegal(StrategyMapGetScanKeyEntry(map, strategy));
 
-		scan = heap_beginscan(relation, false, NowTimeQual, 2, entry);
+		scan = heap_beginscan(relation, false, false, 2, entry);
 
 		while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
 			   HeapTupleIsValid(tuple))
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index f634cf6715de30933f9d9952569eae45ff421438..340d8308121e94c9cfdf28063466a15df2411473 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.20 1997/09/08 21:41:18 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.21 1997/11/20 23:20:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -120,7 +120,7 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
 			{					/* they're equal */
 				btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
 				itup = &(btitem->bti_itup);
-				htup = heap_fetch(heapRel, SelfTimeQual, &(itup->t_tid), NULL);
+				htup = heap_fetch(heapRel, true, &(itup->t_tid), NULL);
 				if (htup != (HeapTuple) NULL)
 				{				/* it is a duplicate */
 					elog(WARN, "Cannot insert a duplicate key into a unique index.");
diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c
index 0bdd55d73223201ad08d773c5b17627803b8c209..bf4c1bfae9dc76015334e16cd84b33971b22c7df 100644
--- a/src/backend/access/nbtree/nbtree.c
+++ b/src/backend/access/nbtree/nbtree.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.23 1997/09/08 21:41:24 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.24 1997/11/20 23:20:21 momjian Exp $
  *
  * NOTES
  *	  This file contains only the public interface routines.
@@ -153,7 +153,7 @@ btbuild(Relation heap,
 #endif							/* OMIT_PARTIAL_INDEX */
 
 	/* start a heap scan */
-	hscan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+	hscan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
 	htup = heap_getnext(hscan, 0, &buffer);
 
 	/* build the index */
diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c
index 9415fc165581210b7de695923db9dc13327e2182..a51f3c36728e6932d9339867ec4bde726ec7151a 100644
--- a/src/backend/access/rtree/rtree.c
+++ b/src/backend/access/rtree/rtree.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.18 1997/09/18 20:19:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.19 1997/11/20 23:20:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -164,7 +164,7 @@ rtbuild(Relation heap,
 		slot = NULL;
 	}
 #endif							/* OMIT_PARTIAL_INDEX */
-	scan = heap_beginscan(heap, 0, NowTimeQual, 0, (ScanKey) NULL);
+	scan = heap_beginscan(heap, 0, false, 0, (ScanKey) NULL);
 	htup = heap_getnext(scan, 0, &buffer);
 
 	/* count the tuples as we insert them */
diff --git a/src/backend/bootstrap/bootstrap.c b/src/backend/bootstrap/bootstrap.c
index 29409a733d993b935b5bbfc3836c273fbe0f0ce1..074a85ac2e25f172dbb36724e84d00a37a3f7717 100644
--- a/src/backend/bootstrap/bootstrap.c
+++ b/src/backend/bootstrap/bootstrap.c
@@ -7,7 +7,7 @@
  * Copyright (c) 1994, Regents of the University of California
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.27 1997/11/17 16:58:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.28 1997/11/20 23:20:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -487,14 +487,14 @@ boot_openrel(char *relname)
 	{
 		StartPortalAllocMode(DefaultAllocMode, 0);
 		rdesc = heap_openr(TypeRelationName);
-		sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+		sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
 		for (i = 0; PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)); ++i);
 		heap_endscan(sdesc);
 		app = Typ = ALLOC(struct typmap *, i + 1);
 		while (i-- > 0)
 			*app++ = ALLOC(struct typmap, 1);
 		*app = (struct typmap *) NULL;
-		sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+		sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
 		app = Typ;
 		while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
 		{
@@ -852,7 +852,7 @@ gettype(char *type)
 		if (DebugMode)
 			printf("bootstrap.c: External Type: %s\n", type);
 		rdesc = heap_openr(TypeRelationName);
-		sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+		sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
 		i = 0;
 		while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
 			++i;
@@ -861,7 +861,7 @@ gettype(char *type)
 		while (i-- > 0)
 			*app++ = ALLOC(struct typmap, 1);
 		*app = (struct typmap *) NULL;
-		sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+		sdesc = heap_beginscan(rdesc, 0, false, 0, (ScanKey) NULL);
 		app = Typ;
 		while (PointerIsValid(tup = heap_getnext(sdesc, 0, (Buffer *) NULL)))
 		{
diff --git a/src/backend/catalog/heap.c b/src/backend/catalog/heap.c
index 9dbec5ce2ebfc34b96f6352b6b71382ec50ed43a..1955237c8fef8588a7ecba8cd72f1f7bc1f1cc56 100644
--- a/src/backend/catalog/heap.c
+++ b/src/backend/catalog/heap.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.30 1997/11/02 15:24:55 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.31 1997/11/20 23:20:38 momjian Exp $
  *
  * INTERFACE ROUTINES
  *		heap_creatr()			- Create an uncataloged heap relation
@@ -500,7 +500,7 @@ RelationAlreadyExists(Relation pg_class_desc, char relname[])
 	 */
 	pg_class_scan = heap_beginscan(pg_class_desc,
 								   0,
-								   NowTimeQual,
+								   false,
 								   1,
 								   &key);
 
@@ -903,7 +903,7 @@ RelationRemoveInheritance(Relation relation)
 
 	scan = heap_beginscan(catalogRelation,
 						  false,
-						  NowTimeQual,
+						  false,
 						  1,
 						  &entry);
 
@@ -931,7 +931,7 @@ RelationRemoveInheritance(Relation relation)
 
 	scan = heap_beginscan(catalogRelation,
 						  false,
-						  NowTimeQual,
+						  false,
 						  1,
 						  &entry);
 
@@ -959,7 +959,7 @@ RelationRemoveInheritance(Relation relation)
 
 	scan = heap_beginscan(catalogRelation,
 						  false,
-						  NowTimeQual,
+						  false,
 						  1,
 						  &entry);
 
@@ -998,7 +998,7 @@ RelationRemoveIndexes(Relation relation)
 
 	scan = heap_beginscan(indexRelation,
 						  false,
-						  NowTimeQual,
+						  false,
 						  1,
 						  &entry);
 
@@ -1046,7 +1046,7 @@ DeletePgRelationTuple(Relation rdesc)
 
 	pg_class_scan = heap_beginscan(pg_class_desc,
 								   0,
-								   NowTimeQual,
+								   false,
 								   1,
 								   &key);
 
@@ -1110,7 +1110,7 @@ DeletePgAttributeTuples(Relation rdesc)
 
 	pg_attribute_scan = heap_beginscan(pg_attribute_desc,
 									   0,
-									   NowTimeQual,
+									   false,
 									   1,
 									   &key);
 
@@ -1179,7 +1179,7 @@ DeletePgTypeTuple(Relation rdesc)
 
 	pg_type_scan = heap_beginscan(pg_type_desc,
 								  0,
-								  NowTimeQual,
+								  false,
 								  1,
 								  &key);
 
@@ -1215,7 +1215,7 @@ DeletePgTypeTuple(Relation rdesc)
 
 	pg_attribute_scan = heap_beginscan(pg_attribute_desc,
 									   0,
-									   NowTimeQual,
+									   false,
 									   1,
 									   &attkey);
 
@@ -1670,7 +1670,7 @@ RemoveAttrDefault(Relation rel)
 
 	RelationSetLockForWrite(adrel);
 
-	adscan = heap_beginscan(adrel, 0, NowTimeQual, 1, &key);
+	adscan = heap_beginscan(adrel, 0, false, 1, &key);
 
 	while (tup = heap_getnext(adscan, 0, (Buffer *) NULL), PointerIsValid(tup))
 		heap_delete(adrel, &tup->t_ctid);
@@ -1697,7 +1697,7 @@ RemoveRelCheck(Relation rel)
 
 	RelationSetLockForWrite(rcrel);
 
-	rcscan = heap_beginscan(rcrel, 0, NowTimeQual, 1, &key);
+	rcscan = heap_beginscan(rcrel, 0, false, 1, &key);
 
 	while (tup = heap_getnext(rcscan, 0, (Buffer *) NULL), PointerIsValid(tup))
 		heap_delete(rcrel, &tup->t_ctid);
diff --git a/src/backend/catalog/index.c b/src/backend/catalog/index.c
index 9ebfc53ac6c74a43814f8fdbcbd2d8224331775b..2ba5f55c4d57008296de1910d1a407e93c3a00f2 100644
--- a/src/backend/catalog/index.c
+++ b/src/backend/catalog/index.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.25 1997/11/02 15:25:01 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.26 1997/11/20 23:20:44 momjian Exp $
  *
  *
  * INTERFACE ROUTINES
@@ -178,7 +178,7 @@ RelationNameGetObjectId(char *relationName,
 						   NameEqualRegProcedure,
 						   PointerGetDatum(relationName));
 
-	pg_class_scan = heap_beginscan(pg_class, 0, NowTimeQual, 1, &key);
+	pg_class_scan = heap_beginscan(pg_class, 0, false, 1, &key);
 
 	/* ----------------
 	 *	if we find the named relation, fetch its relation id
@@ -505,7 +505,7 @@ AccessMethodObjectIdGetAccessMethodTupleForm(Oid accessMethodObjectId)
 	 * ----------------
 	 */
 	pg_am_desc = heap_openr(AccessMethodRelationName);
-	pg_am_scan = heap_beginscan(pg_am_desc, 0, NowTimeQual, 1, &key);
+	pg_am_scan = heap_beginscan(pg_am_desc, 0, false, 1, &key);
 
 	pg_am_tuple = heap_getnext(pg_am_scan, 0, (Buffer *) NULL);
 
@@ -952,7 +952,7 @@ UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
 						   ObjectIdEqualRegProcedure,
 						   ObjectIdGetDatum(indexoid));
 
-	scan = heap_beginscan(pg_index, 0, NowTimeQual, 1, &entry);
+	scan = heap_beginscan(pg_index, 0, false, 1, &entry);
 	tuple = heap_getnext(scan, 0, &buffer);
 	heap_endscan(scan);
 
@@ -1249,7 +1249,7 @@ index_destroy(Oid indexId)
 						   ObjectIdEqualRegProcedure,
 						   ObjectIdGetDatum(indexId));;
 
-	scan = heap_beginscan(catalogRelation, 0, NowTimeQual, 1, &entry);
+	scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
 	tuple = heap_getnext(scan, 0, (Buffer *) NULL);
 
 	AssertState(HeapTupleIsValid(tuple));
@@ -1266,7 +1266,7 @@ index_destroy(Oid indexId)
 
 	entry.sk_attno = Anum_pg_attribute_attrelid;
 
-	scan = heap_beginscan(catalogRelation, 0, NowTimeQual, 1, &entry);
+	scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
 
 	while (tuple = heap_getnext(scan, 0, (Buffer *) NULL),
 		   HeapTupleIsValid(tuple))
@@ -1285,7 +1285,7 @@ index_destroy(Oid indexId)
 
 	entry.sk_attno = Anum_pg_index_indexrelid;
 
-	scan = heap_beginscan(catalogRelation, 0, NowTimeQual, 1, &entry);
+	scan = heap_beginscan(catalogRelation, 0, false, 1, &entry);
 	tuple = heap_getnext(scan, 0, (Buffer *) NULL);
 	if (!HeapTupleIsValid(tuple))
 	{
@@ -1415,7 +1415,7 @@ UpdateStats(Oid relid, long reltuples, bool hasindex)
 	key[0].sk_argument = ObjectIdGetDatum(relid);
 
 	pg_class_scan =
-		heap_beginscan(pg_class, 0, NowTimeQual, 1, key);
+		heap_beginscan(pg_class, 0, false, 1, key);
 
 	if (!HeapScanIsValid(pg_class_scan))
 	{
@@ -1611,7 +1611,7 @@ DefaultBuild(Relation heapRelation,
 	 */
 	scan = heap_beginscan(heapRelation, /* relation */
 						  0,	/* start at end */
-						  NowTimeQual,	/* time range */
+						  false, /* seeself */
 						  0,	/* number of keys */
 						  (ScanKey) NULL);		/* scan key */
 
@@ -1825,7 +1825,7 @@ IndexIsUniqueNoCache(Oid indexId)
 						   (RegProcedure) ObjectIdEqualRegProcedure,
 						   ObjectIdGetDatum(indexId));
 
-	scandesc = heap_beginscan(pg_index, 0, SelfTimeQual, 1, skey);
+	scandesc = heap_beginscan(pg_index, 0, true, 1, skey);
 
 	tuple = heap_getnext(scandesc, 0, NULL);
 	if (!HeapTupleIsValid(tuple))
diff --git a/src/backend/catalog/indexing.c b/src/backend/catalog/indexing.c
index 1927d84f06336512a3be9f1a4ec48a5ab9806e54..be09fd8103fb6e1d51ebe06a5919a28e560cc68d 100644
--- a/src/backend/catalog/indexing.c
+++ b/src/backend/catalog/indexing.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.15 1997/09/08 21:42:20 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.16 1997/11/20 23:20:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -242,7 +242,7 @@ CatalogIndexFetchTuple(Relation heapRelation,
 			ItemPointer iptr;
 
 			iptr = &indexRes->heap_iptr;
-			tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+			tuple = heap_fetch(heapRelation, false, iptr, &buffer);
 			pfree(indexRes);
 		}
 		else
@@ -394,7 +394,7 @@ ProcedureNameIndexScan(Relation heapRelation,
 			ItemPointer iptr;
 
 			iptr = &indexRes->heap_iptr;
-			tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+			tuple = heap_fetch(heapRelation, false, iptr, &buffer);
 			pfree(indexRes);
 			if (HeapTupleIsValid(tuple))
 			{
@@ -459,7 +459,7 @@ ProcedureSrcIndexScan(Relation heapRelation, text *procSrc)
 		ItemPointer iptr;
 
 		iptr = &indexRes->heap_iptr;
-		tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+		tuple = heap_fetch(heapRelation, false, iptr, &buffer);
 		pfree(indexRes);
 	}
 	else
diff --git a/src/backend/catalog/pg_operator.c b/src/backend/catalog/pg_operator.c
index b3ede1b3ccb71ee45dac3cd60838d990f2d616e6..32c2a038c8a43cca88ecfc6c2cc5905bbbd8fa88 100644
--- a/src/backend/catalog/pg_operator.c
+++ b/src/backend/catalog/pg_operator.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.14 1997/09/18 20:20:18 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_operator.c,v 1.15 1997/11/20 23:20:49 momjian Exp $
  *
  * NOTES
  *	  these routines moved here from commands/define.c and somewhat cleaned up.
@@ -116,7 +116,7 @@ OperatorGetWithOpenRelation(Relation pg_operator_desc,
 	 */
 	pg_operator_scan = heap_beginscan(pg_operator_desc,
 									  0,
-									  SelfTimeQual,
+									  true,
 									  3,
 									  opKey);
 
@@ -697,7 +697,7 @@ OperatorDef(char *operatorName,
 
 		pg_operator_scan = heap_beginscan(pg_operator_desc,
 										  0,
-										  SelfTimeQual,
+										  true,
 										  3,
 										  opKey);
 
@@ -796,7 +796,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
 
 	pg_operator_scan = heap_beginscan(pg_operator_desc,
 									  0,
-									  SelfTimeQual,
+									  true,
 									  1,
 									  opKey);
 
@@ -886,7 +886,7 @@ OperatorUpd(Oid baseId, Oid commId, Oid negId)
 
 	pg_operator_scan = heap_beginscan(pg_operator_desc,
 									  0,
-									  SelfTimeQual,
+									  true,
 									  1,
 									  opKey);
 
diff --git a/src/backend/catalog/pg_type.c b/src/backend/catalog/pg_type.c
index 0c2292ab29614cb3d6b087f7e2469df2d38dbece..62f0161ffa2da52a1e57f3aca9da16e498d629b1 100644
--- a/src/backend/catalog/pg_type.c
+++ b/src/backend/catalog/pg_type.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.11 1997/09/18 20:20:19 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/catalog/pg_type.c,v 1.12 1997/11/20 23:20:50 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -66,7 +66,7 @@ TypeGetWithOpenRelation(Relation pg_type_desc,
 
 	scan = heap_beginscan(pg_type_desc,
 						  0,
-						  SelfTimeQual,
+						  true,
 						  1,
 						  typeKey);
 
@@ -472,7 +472,7 @@ TypeCreate(char *typeName,
 	typeKey[0].sk_argument = PointerGetDatum(typeName);
 	pg_type_scan = heap_beginscan(pg_type_desc,
 								  0,
-								  SelfTimeQual,
+								  true,
 								  1,
 								  typeKey);
 
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c
index 021d00e4c9e212f522a0b695d51902cc9b068c76..257be8a1e9aa0248eda9581bd118be7460deb271 100644
--- a/src/backend/commands/async.c
+++ b/src/backend/commands/async.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.23 1997/11/05 21:18:54 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/async.c,v 1.24 1997/11/20 23:20:56 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -206,7 +206,7 @@ Async_Notify(char *relname)
 	lRel = heap_openr(ListenerRelationName);
 	tdesc = RelationGetTupleDescriptor(lRel);
 	RelationSetLockForWrite(lRel);
-	sRel = heap_beginscan(lRel, 0, NowTimeQual, 1, &key);
+	sRel = heap_beginscan(lRel, 0, false, 1, &key);
 
 	nulls[0] = nulls[1] = nulls[2] = ' ';
 	repl[0] = repl[1] = repl[2] = ' ';
@@ -287,7 +287,7 @@ Async_NotifyAtCommit()
 								   Int32GetDatum(1));
 			lRel = heap_openr(ListenerRelationName);
 			RelationSetLockForWrite(lRel);
-			sRel = heap_beginscan(lRel, 0, NowTimeQual, 1, &key);
+			sRel = heap_beginscan(lRel, 0, false, 1, &key);
 			tdesc = RelationGetTupleDescriptor(lRel);
 			ourpid = getpid();
 
@@ -441,7 +441,7 @@ Async_Listen(char *relname, int pid)
 
 	/* is someone already listening.  One listener per relation */
 	tdesc = RelationGetTupleDescriptor(lDesc);
-	s = heap_beginscan(lDesc, 0, NowTimeQual, 0, (ScanKey) NULL);
+	s = heap_beginscan(lDesc, 0, false, 0, (ScanKey) NULL);
 	while (HeapTupleIsValid(htup = heap_getnext(s, 0, &b)))
 	{
 		d = heap_getattr(htup, b, Anum_pg_listener_relname, tdesc,
@@ -599,7 +599,7 @@ Async_NotifyFrontEnd()
 	lRel = heap_openr(ListenerRelationName);
 	RelationSetLockForWrite(lRel);
 	tdesc = RelationGetTupleDescriptor(lRel);
-	sRel = heap_beginscan(lRel, 0, NowTimeQual, 2, key);
+	sRel = heap_beginscan(lRel, 0, false, 2, key);
 
 	nulls[0] = nulls[1] = nulls[2] = ' ';
 	repl[0] = repl[1] = repl[2] = ' ';
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 9e93388f729e433dc2a275c3ef29e254bf0332eb..3bfdb961541d7d7fabebfbb3a2e3879a1d29682f 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -14,7 +14,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.15 1997/09/08 02:21:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.16 1997/11/20 23:20:58 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -355,7 +355,7 @@ rebuildheap(Oid OIDNewHeap, Oid OIDOldHeap, Oid OIDOldIndex)
 	{
 
 		HeapTid = &ScanResult->heap_iptr;
-		LocalHeapTuple = heap_fetch(LocalOldHeap, 0, HeapTid, &LocalBuffer);
+		LocalHeapTuple = heap_fetch(LocalOldHeap, false, HeapTid, &LocalBuffer);
 		OIDNewHeapInsert =
 			heap_insert(LocalNewHeap, LocalHeapTuple);
 		pfree(ScanResult);
diff --git a/src/backend/commands/command.c b/src/backend/commands/command.c
index 1f80e9e2e0d51392725e92bcfa5bbeb08d9b55f4..d33edbb7f9b8094ec2e4915e295cc04da9f0f17f 100644
--- a/src/backend/commands/command.c
+++ b/src/backend/commands/command.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.20 1997/10/27 08:55:16 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.21 1997/11/20 23:21:00 momjian Exp $
  *
  * NOTES
  *	  The PortalExecutorHeapMemory crap needs to be eliminated
@@ -440,7 +440,7 @@ PerformAddAttribute(char *relationName,
 		 * XXX use syscache here as an optimization
 		 */
 		key[1].sk_argument = (Datum) colDef->colname;
-		attsdesc = heap_beginscan(attrdesc, 0, NowTimeQual, 2, key);
+		attsdesc = heap_beginscan(attrdesc, 0, false, 2, key);
 
 
 		tup = heap_getnext(attsdesc, 0, (Buffer *) NULL);
diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c
index 8593aa3f25a287e7ef677e547ce86b7b9409c689..fdc998b9418e9c6ab06e6ca459482a7be8059e1b 100644
--- a/src/backend/commands/copy.c
+++ b/src/backend/commands/copy.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.34 1997/09/12 04:07:25 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.35 1997/11/20 23:21:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -224,7 +224,7 @@ CopyTo(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
 	int32		ntuples;
 	TupleDesc	tupDesc;
 
-	scandesc = heap_beginscan(rel, 0, NULL, 0, NULL);
+	scandesc = heap_beginscan(rel, 0, false, 0, NULL);
 
 	attr_count = rel->rd_att->natts;
 	attr = rel->rd_att->attrs;
@@ -921,7 +921,7 @@ GetIndexRelations(Oid main_relation_oid,
 	bool		isnull;
 
 	pg_index_rel = heap_openr(IndexRelationName);
-	scandesc = heap_beginscan(pg_index_rel, 0, NULL, 0, NULL);
+	scandesc = heap_beginscan(pg_index_rel, 0, false, 0, NULL);
 	tupDesc = RelationGetTupleDescriptor(pg_index_rel);
 
 	*n_indices = 0;
@@ -1198,7 +1198,7 @@ CountTuples(Relation relation)
 
 	int			i;
 
-	scandesc = heap_beginscan(relation, 0, NULL, 0, NULL);
+	scandesc = heap_beginscan(relation, 0, false, 0, NULL);
 
 	for (tuple = heap_getnext(scandesc, 0, NULL), i = 0;
 		 tuple != NULL;
diff --git a/src/backend/commands/proclang.c b/src/backend/commands/proclang.c
index 2b8836b70bbf8cdd654938b89f36008741c35287..8cc8b5ae48c6ba27bb9a0ea498ede22c505123d8 100644
--- a/src/backend/commands/proclang.c
+++ b/src/backend/commands/proclang.c
@@ -189,7 +189,7 @@ DropProceduralLanguage(DropPLangStmt * stmt)
 	ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_language_lanname,
 						   F_NAMEEQ, PointerGetDatum(languageName));
 
-	scanDesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, &scanKeyData);
+	scanDesc = heap_beginscan(rdesc, 0, false, 1, &scanKeyData);
 
 	tup = heap_getnext(scanDesc, 0, (Buffer *) NULL);
 
diff --git a/src/backend/commands/purge.c b/src/backend/commands/purge.c
index 78265c93cc5495a7fd6585543eeb8166eebb5773..b0f673662651ddfe117ab09f735a8dffc61fb763 100644
--- a/src/backend/commands/purge.c
+++ b/src/backend/commands/purge.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.8 1997/09/08 02:22:11 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/purge.c,v 1.9 1997/11/20 23:21:08 momjian Exp $
  *
  * Note:
  *		XXX There are many instances of int32 instead of ...Time.  These
@@ -110,7 +110,7 @@ RelationPurge(char *relationName,
 	key[0].sk_argument = PointerGetDatum(relationName);
 	fmgr_info(key[0].sk_procedure, &key[0].sk_func, &key[0].sk_nargs);
 
-	scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+	scan = heap_beginscan(relation, 0, false, 1, key);
 	oldTuple = heap_getnext(scan, 0, &buffer);
 	if (!HeapTupleIsValid(oldTuple))
 	{
diff --git a/src/backend/commands/recipe.c b/src/backend/commands/recipe.c
index 077e88237800c1de5671850905664f9fc1d371b0..43d84c5a01adf3600b51b481e51dd4fb3c3388cd 100644
--- a/src/backend/commands/recipe.c
+++ b/src/backend/commands/recipe.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.10 1997/10/25 01:08:54 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/recipe.c,v 1.11 1997/11/20 23:21:10 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -804,8 +804,7 @@ tg_parseTeeNode(TgRecipe * r,
 												  tt,
 												  tt,
 												  FALSE,
-												  FALSE,
-												  NULL));
+												  FALSE));
 		rt_ind = length(orig->rtable);
 	}
 
diff --git a/src/backend/commands/remove.c b/src/backend/commands/remove.c
index daa37b6714b1c8c2c5a5b72230326ac50e80d0a6..aaf2127e460bd0aa8636907ce09bbb4967b50ddf 100644
--- a/src/backend/commands/remove.c
+++ b/src/backend/commands/remove.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.15 1997/09/18 20:20:24 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/Attic/remove.c,v 1.16 1997/11/20 23:21:13 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -95,7 +95,7 @@ RemoveOperator(char *operatorName,		/* operator name */
 						   ObjectIdGetDatum(typeId2));
 
 	relation = heap_openr(OperatorRelationName);
-	scan = heap_beginscan(relation, 0, NowTimeQual, 3, operatorKey);
+	scan = heap_beginscan(relation, 0, false, 3, operatorKey);
 	tup = heap_getnext(scan, 0, &buffer);
 	if (HeapTupleIsValid(tup))
 	{
@@ -163,7 +163,7 @@ SingleOpOperatorRemove(Oid typeOid)
 	for (i = 0; i < 3; ++i)
 	{
 		key[0].sk_attno = attnums[i];
-		sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, key);
+		sdesc = heap_beginscan(rdesc, 0, false, 1, key);
 		while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
 		{
 			ItemPointerCopy(&tup->t_ctid, &itemPointerData);
@@ -212,7 +212,7 @@ AttributeAndRelationRemove(Oid typeOid)
 	oidptr->next = NULL;
 	optr = oidptr;
 	rdesc = heap_openr(AttributeRelationName);
-	sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, key);
+	sdesc = heap_beginscan(rdesc, 0, false, 1, key);
 	while (PointerIsValid(tup = heap_getnext(sdesc, 0, &buffer)))
 	{
 		ItemPointerCopy(&tup->t_ctid, &itemPointerData);
@@ -233,7 +233,7 @@ AttributeAndRelationRemove(Oid typeOid)
 	while (PointerIsValid((char *) optr->next))
 	{
 		key[0].sk_argument = (Datum) (optr++)->reloid;
-		sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 1, key);
+		sdesc = heap_beginscan(rdesc, 0, false, 1, key);
 		tup = heap_getnext(sdesc, 0, &buffer);
 		if (PointerIsValid(tup))
 		{
@@ -283,7 +283,7 @@ RemoveType(char *typeName)		/* type name to be removed */
 
 	typeKey[0].sk_argument = PointerGetDatum(typeName);
 
-	scan = heap_beginscan(relation, 0, NowTimeQual, 1, typeKey);
+	scan = heap_beginscan(relation, 0, false, 1, typeKey);
 	tup = heap_getnext(scan, 0, (Buffer *) 0);
 	if (!HeapTupleIsValid(tup))
 	{
@@ -301,7 +301,7 @@ RemoveType(char *typeName)		/* type name to be removed */
 	shadow_type = makeArrayTypeName(typeName);
 	typeKey[0].sk_argument = NameGetDatum(shadow_type);
 
-	scan = heap_beginscan(relation, 0, NowTimeQual,
+	scan = heap_beginscan(relation, 0, false,
 						  1, (ScanKey) typeKey);
 	tup = heap_getnext(scan, 0, (Buffer *) 0);
 
@@ -389,7 +389,7 @@ RemoveFunction(char *functionName,		/* function name to be removed */
 	fmgr_info(key[0].sk_procedure, &key[0].sk_func, &key[0].sk_nargs);
 
 	relation = heap_openr(ProcedureRelationName);
-	scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+	scan = heap_beginscan(relation, 0, false, 1, key);
 
 	do
 	{							/* hope this is ok because it's indexed */
@@ -496,7 +496,7 @@ RemoveAggregate(char *aggName, char *aggType)
 						   ObjectIdGetDatum(basetypeID));
 
 	relation = heap_openr(AggregateRelationName);
-	scan = heap_beginscan(relation, 0, NowTimeQual, 2, aggregateKey);
+	scan = heap_beginscan(relation, 0, false, 2, aggregateKey);
 	tup = heap_getnext(scan, 0, (Buffer *) 0);
 	if (!HeapTupleIsValid(tup))
 	{
diff --git a/src/backend/commands/trigger.c b/src/backend/commands/trigger.c
index 273136b29233811edc59c54b790ef261fd657c10..3427936f284f2c0f9ea98da2f64a0af9719b01a2 100644
--- a/src/backend/commands/trigger.c
+++ b/src/backend/commands/trigger.c
@@ -119,7 +119,7 @@ CreateTrigger(CreateTrigStmt * stmt)
 	RelationSetLockForWrite(tgrel);
 	ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
 						   ObjectIdEqualRegProcedure, rel->rd_id);
-	tgscan = heap_beginscan(tgrel, 0, NowTimeQual, 1, &key);
+	tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
 	while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
 	{
 		Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
@@ -279,7 +279,7 @@ DropTrigger(DropTrigStmt * stmt)
 	RelationSetLockForWrite(tgrel);
 	ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
 						   ObjectIdEqualRegProcedure, rel->rd_id);
-	tgscan = heap_beginscan(tgrel, 0, NowTimeQual, 1, &key);
+	tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
 	while (tuple = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tuple))
 	{
 		Form_pg_trigger pg_trigger = (Form_pg_trigger) GETSTRUCT(tuple);
@@ -344,7 +344,7 @@ RelationRemoveTriggers(Relation rel)
 	ScanKeyEntryInitialize(&key, 0, Anum_pg_trigger_tgrelid,
 						   ObjectIdEqualRegProcedure, rel->rd_id);
 
-	tgscan = heap_beginscan(tgrel, 0, NowTimeQual, 1, &key);
+	tgscan = heap_beginscan(tgrel, 0, false, 1, &key);
 
 	while (tup = heap_getnext(tgscan, 0, (Buffer *) NULL), PointerIsValid(tup))
 		heap_delete(tgrel, &tup->t_ctid);
@@ -395,7 +395,7 @@ RelationBuildTriggers(Relation relation)
 			break;
 
 		iptr = &indexRes->heap_iptr;
-		tuple = heap_fetch(tgrel, NowTimeQual, iptr, &buffer);
+		tuple = heap_fetch(tgrel, false, iptr, &buffer);
 		pfree(indexRes);
 		if (!HeapTupleIsValid(tuple))
 			continue;
@@ -859,7 +859,7 @@ GetTupleForTrigger(Relation relation, ItemPointer tid, bool before)
 		}
 
 		HeapTupleSatisfies(lp, relation, b, dp,
-						   NowTimeQual, 0, (ScanKey) NULL, tuple);
+						   false, 0, (ScanKey) NULL, tuple);
 		if (!tuple)
 		{
 			ReleaseBuffer(b);
diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c
index 1ce7b0998dbd0d8410feb7372297b41cae564f97..2ecc827b44256c545ae18f99143a10cc1aec4583 100644
--- a/src/backend/commands/vacuum.c
+++ b/src/backend/commands/vacuum.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.49 1997/11/02 15:25:07 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.50 1997/11/20 23:21:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -296,7 +296,7 @@ vc_getrels(NameData *VacRelP)
 	pgclass = heap_openr(RelationRelationName);
 	pgcdesc = RelationGetTupleDescriptor(pgclass);
 
-	pgcscan = heap_beginscan(pgclass, false, NowTimeQual, 1, &pgckey);
+	pgcscan = heap_beginscan(pgclass, false, false, 1, &pgckey);
 
 	while (HeapTupleIsValid(pgctup = heap_getnext(pgcscan, 0, &buf)))
 	{
@@ -429,7 +429,7 @@ vc_vacone(Oid relid, bool analyze, List *va_cols)
 
 	pgclass = heap_openr(RelationRelationName);
 	pgcdesc = RelationGetTupleDescriptor(pgclass);
-	pgcscan = heap_beginscan(pgclass, false, NowTimeQual, 1, &pgckey);
+	pgcscan = heap_beginscan(pgclass, false, false, 1, &pgckey);
 
 	/*
 	 * Race condition -- if the pg_class tuple has gone away since the
@@ -1856,7 +1856,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
 						   ObjectIdGetDatum(relid));
 
 	rd = heap_openr(RelationRelationName);
-	rsdesc = heap_beginscan(rd, false, NowTimeQual, 1, &rskey);
+	rsdesc = heap_beginscan(rd, false, false, 1, &rskey);
 
 	if (!HeapTupleIsValid(rtup = heap_getnext(rsdesc, 0, &rbuf)))
 		elog(WARN, "pg_class entry for relid %d vanished during vacuuming",
@@ -1879,7 +1879,7 @@ vc_updstats(Oid relid, int npages, int ntups, bool hasindex, VRelStats *vacrelst
 		ScanKeyEntryInitialize(&askey, 0, Anum_pg_attribute_attrelid,
 							   F_INT4EQ, relid);
 
-		asdesc = heap_beginscan(ad, false, NowTimeQual, 1, &askey);
+		asdesc = heap_beginscan(ad, false, false, 1, &askey);
 
 		while (HeapTupleIsValid(atup = heap_getnext(asdesc, 0, &abuf)))
 		{
@@ -2027,10 +2027,10 @@ vc_delhilowstats(Oid relid, int attcnt, int *attnums)
 		ScanKeyEntryInitialize(&pgskey, 0x0, Anum_pg_statistic_starelid,
 							   ObjectIdEqualRegProcedure,
 							   ObjectIdGetDatum(relid));
-		pgsscan = heap_beginscan(pgstatistic, false, NowTimeQual, 1, &pgskey);
+		pgsscan = heap_beginscan(pgstatistic, false, false, 1, &pgskey);
 	}
 	else
-		pgsscan = heap_beginscan(pgstatistic, false, NowTimeQual, 0, NULL);
+		pgsscan = heap_beginscan(pgstatistic, false, false, 0, NULL);
 
 	while (HeapTupleIsValid(pgstup = heap_getnext(pgsscan, 0, NULL)))
 	{
@@ -2284,7 +2284,7 @@ vc_getindices(Oid relid, int *nindices, Relation **Irel)
 						   ObjectIdEqualRegProcedure,
 						   ObjectIdGetDatum(relid));
 
-	pgiscan = heap_beginscan(pgindex, false, NowTimeQual, 1, &pgikey);
+	pgiscan = heap_beginscan(pgindex, false, false, 1, &pgikey);
 
 	while (HeapTupleIsValid(pgitup = heap_getnext(pgiscan, 0, NULL)))
 	{
diff --git a/src/backend/commands/view.c b/src/backend/commands/view.c
index ca4ff5a942517bbd48f31ca1a132f6ebe18b4d2e..72d6159b2a6c23af29004be8a6d06ac692d8e27a 100644
--- a/src/backend/commands/view.c
+++ b/src/backend/commands/view.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.13 1997/11/17 16:58:59 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/commands/view.c,v 1.14 1997/11/20 23:21:18 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -236,10 +236,10 @@ UpdateRangeTableOfViewParse(char *viewName, Query *viewParse)
 	 */
 	rt_entry1 =
 		addRangeTableEntry(NULL, (char *) viewName, "*CURRENT*",
-						   FALSE, FALSE, NULL);
+						   FALSE, FALSE);
 	rt_entry2 =
 		addRangeTableEntry(NULL, (char *) viewName, "*NEW*",
-						   FALSE, FALSE, NULL);
+						   FALSE, FALSE);
 	new_rt = lcons(rt_entry2, old_rt);
 	new_rt = lcons(rt_entry1, new_rt);
 
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index ad659f5995ea192f90a8e9e42b9886920945eab1..bffb0f26eb4a1d03a43729a86435c702549bff78 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.8 1997/09/08 21:42:52 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.9 1997/11/20 23:21:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -45,7 +45,7 @@
 
 static Pointer
 ExecBeginScan(Relation relation, int nkeys, ScanKey skeys,
-			  bool isindex, ScanDirection dir, TimeQual time_range);
+			  bool isindex, ScanDirection dir);
 static Relation ExecOpenR(Oid relationOid, bool isindex);
 
 /* ----------------------------------------------------------------
@@ -70,7 +70,6 @@ ExecOpenScanR(Oid relOid,
 			  ScanKey skeys,
 			  bool isindex,
 			  ScanDirection dir,
-			  TimeQual timeRange,
 			  Relation *returnRelation, /* return */
 			  Pointer *returnScanDesc)	/* return */
 {
@@ -89,8 +88,7 @@ ExecOpenScanR(Oid relOid,
 							 nkeys,
 							 skeys,
 							 isindex,
-							 dir,
-							 timeRange);
+							 dir);
 
 	if (returnRelation != NULL)
 		*returnRelation = relation;
@@ -146,8 +144,7 @@ ExecBeginScan(Relation relation,
 			  int nkeys,
 			  ScanKey skeys,
 			  bool isindex,
-			  ScanDirection dir,
-			  TimeQual time_range)
+			  ScanDirection dir)
 {
 	Pointer		scanDesc;
 
@@ -172,7 +169,7 @@ ExecBeginScan(Relation relation,
 	{
 		scanDesc = (Pointer) heap_beginscan(relation,
 											ScanDirectionIsBackward(dir),
-											time_range,
+											false,
 											nkeys,
 											skeys);
 	}
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c
index e088f236555fe7a10569179232c9ff049d2fc6fc..45ad2efba6e78557018aa04fe9d332088da3204c 100644
--- a/src/backend/executor/execMain.c
+++ b/src/backend/executor/execMain.c
@@ -26,7 +26,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.30 1997/11/17 16:41:04 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execMain.c,v 1.31 1997/11/20 23:21:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1331,13 +1331,11 @@ ExecRelCheck(Relation rel, HeapTuple tuple)
 	slot->ttc_buffer = InvalidBuffer;
 	slot->ttc_whichplan = -1;
 	rte->relname = nameout(&(rel->rd_rel->relname));
-	rte->timeRange = NULL;
 	rte->refname = rte->relname;
 	rte->relid = rel->rd_id;
 	rte->inh = false;
 	rte->archive = false;
 	rte->inFromCl = true;
-	rte->timeQual = NULL;
 	rtlist = lcons(rte, NIL);
 	econtext->ecxt_scantuple = slot;	/* scan tuple slot */
 	econtext->ecxt_innertuple = NULL;	/* inner tuple slot */
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c
index 2282775c9a58f693b25371baa967f4d49d7f1020..653c4ed48f56993d19de3aa086774dcb42d39782 100644
--- a/src/backend/executor/execUtils.c
+++ b/src/backend/executor/execUtils.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.20 1997/10/25 01:09:10 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.21 1997/11/20 23:21:26 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -756,7 +756,7 @@ ExecOpenIndices(Oid resultRelationOid,
 	 */
 	indexSd = heap_beginscan(indexRd,	/* scan desc */
 							 false,		/* scan backward flag */
-							 NowTimeQual,		/* time qual */
+							 false,		/* see self */
 							 1, /* number scan keys */
 							 &key);		/* scan keys */
 
diff --git a/src/backend/executor/nodeIndexscan.c b/src/backend/executor/nodeIndexscan.c
index 2ad35f822ee9186ffc5e7e64f19fbb6b20e494c9..ad6920a09bff16e974d9814f9ddab09d6711987a 100644
--- a/src/backend/executor/nodeIndexscan.c
+++ b/src/backend/executor/nodeIndexscan.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.10 1997/09/08 21:43:13 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeIndexscan.c,v 1.11 1997/11/20 23:21:28 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -128,7 +128,7 @@ IndexNext(IndexScan *node)
 		{
 			iptr = &result->heap_iptr;
 			tuple = heap_fetch(heapRelation,
-							   NowTimeQual,
+							   false,
 							   iptr,
 							   &buffer);
 			/* be tidy */
@@ -480,7 +480,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
 	RangeTblEntry *rtentry;
 	Index		relid;
 	Oid			reloid;
-	TimeQual	timeQual;
 
 	Relation	currentRelation;
 	HeapScanDesc currentScanDesc;
@@ -911,14 +910,12 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
 	relid = node->scan.scanrelid;
 	rtentry = rt_fetch(relid, rangeTable);
 	reloid = rtentry->relid;
-	timeQual = rtentry->timeQual;
 
 	ExecOpenScanR(reloid,		/* relation */
 				  0,			/* nkeys */
 				  (ScanKey) NULL,		/* scan key */
 				  0,			/* is index */
 				  direction,	/* scan direction */
-				  timeQual,		/* time qual */
 				  &currentRelation,		/* return: rel desc */
 				  (Pointer *) &currentScanDesc);		/* return: scan desc */
 
@@ -957,7 +954,6 @@ ExecInitIndexScan(IndexScan *node, EState *estate, Plan *parent)
 						  scanKeys[i],	/* scan key */
 						  true, /* is index */
 						  direction,	/* scan direction */
-						  timeQual,		/* time qual */
 						  &(relationDescs[i]),	/* return: rel desc */
 						  (Pointer *) &(scanDescs[i]));
 			/* return: scan desc */
diff --git a/src/backend/executor/nodeMaterial.c b/src/backend/executor/nodeMaterial.c
index ecb7c0ee28360951bd6a74135dbbff4fa131da32..e863d25a73808c7c31c29f723794c4e7b4d2d19a 100644
--- a/src/backend/executor/nodeMaterial.c
+++ b/src/backend/executor/nodeMaterial.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.9 1997/09/08 21:43:14 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeMaterial.c,v 1.10 1997/11/20 23:21:32 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -140,7 +140,7 @@ ExecMaterial(Material *node)
 		currentScanDesc = heap_beginscan(currentRelation,		/* relation */
 										 ScanDirectionIsBackward(dir),
 		/* bkwd flag */
-										 NowTimeQual,	/* time qual */
+										 false, /* seeself */
 										 0,		/* num scan keys */
 										 NULL); /* scan keys */
 		matstate->csstate.css_currentRelation = currentRelation;
diff --git a/src/backend/executor/nodeSeqscan.c b/src/backend/executor/nodeSeqscan.c
index 5bcde93479fbb305a8fd9600341187455d6774ec..fd8485daa381b6c5ebab17238809fc1ae4e5bb86 100644
--- a/src/backend/executor/nodeSeqscan.c
+++ b/src/backend/executor/nodeSeqscan.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.7 1997/09/08 21:43:17 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/nodeSeqscan.c,v 1.8 1997/11/20 23:21:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -158,7 +158,6 @@ InitScanRelation(SeqScan *node, EState *estate,
 	List	   *rangeTable;
 	RangeTblEntry *rtentry;
 	Oid			reloid;
-	TimeQual	timeQual;
 	ScanDirection direction;
 	Relation	currentRelation;
 	HeapScanDesc currentScanDesc;
@@ -179,7 +178,6 @@ InitScanRelation(SeqScan *node, EState *estate,
 		rangeTable = estate->es_range_table;
 		rtentry = rt_fetch(relid, rangeTable);
 		reloid = rtentry->relid;
-		timeQual = rtentry->timeQual;
 		direction = estate->es_direction;
 		resultRelationInfo = estate->es_result_relation_info;
 
@@ -188,7 +186,6 @@ InitScanRelation(SeqScan *node, EState *estate,
 					  NULL,		/* scan key */
 					  0,		/* is index */
 					  direction,/* scan direction */
-					  timeQual, /* time qual */
 					  &currentRelation, /* return: rel desc */
 					  (Pointer *) &currentScanDesc);	/* return: scan desc */
 
diff --git a/src/backend/executor/nodeTee.c b/src/backend/executor/nodeTee.c
index d7c0c19d2eed8f0a106c9bb099d30e5cc3a876e0..149885e9dc55088a6b8475c5866be15e4081051d 100644
--- a/src/backend/executor/nodeTee.c
+++ b/src/backend/executor/nodeTee.c
@@ -15,7 +15,7 @@
  *		ExecEndTee
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.9 1997/09/08 21:43:20 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/executor/Attic/nodeTee.c,v 1.10 1997/11/20 23:21:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -252,7 +252,7 @@ initTeeScanDescs(Tee *node)
 	{
 		teeState->tee_leftScanDesc = heap_beginscan(bufferRel,
 											ScanDirectionIsBackward(dir),
-													NowTimeQual,		/* time qual */
+													false, /* seeself */
 													0,	/* num scan keys */
 													NULL		/* scan keys */
 			);
@@ -261,7 +261,7 @@ initTeeScanDescs(Tee *node)
 	{
 		teeState->tee_rightScanDesc = heap_beginscan(bufferRel,
 											ScanDirectionIsBackward(dir),
-													 NowTimeQual,		/* time qual */
+													 false, /* seeself */
 													 0, /* num scan keys */
 													 NULL		/* scan keys */
 			);
diff --git a/src/backend/nodes/copyfuncs.c b/src/backend/nodes/copyfuncs.c
index 4c46c03e5bdc6d5062b8bbc4cd00c615a278e4ee..62b72ab8344f0eed527309222b1050ed73bd2091 100644
--- a/src/backend/nodes/copyfuncs.c
+++ b/src/backend/nodes/copyfuncs.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.14 1997/11/02 15:25:11 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v 1.15 1997/11/20 23:21:40 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1470,8 +1470,6 @@ _copyRangeTblEntry(RangeTblEntry *from)
 		newnode->relname = pstrdup(from->relname);
 	if (from->refname)
 		newnode->refname = pstrdup(from->refname);
-	newnode->timeRange = NULL;
-	newnode->timeQual = NULL;
 
 	return newnode;
 }
diff --git a/src/backend/optimizer/path/indxpath.c b/src/backend/optimizer/path/indxpath.c
index 1527ca4fac228af5d149ceb86f4e5c25391bae29..2fc43e0fdab2c0399519fa98c7b57d264e5c48de 100644
--- a/src/backend/optimizer/path/indxpath.c
+++ b/src/backend/optimizer/path/indxpath.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.11 1997/09/08 21:44:55 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/path/indxpath.c,v 1.12 1997/11/20 23:21:47 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -998,7 +998,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
 	 * will be used to find the associated strategy numbers for the test.
 	 * --Nels, Jan '93
 	 */
-	scan = heap_beginscan(relation, false, NowTimeQual, 2, entry);
+	scan = heap_beginscan(relation, false, false, 2, entry);
 	tuple = heap_getnext(scan, false, (Buffer *) NULL);
 	if (!HeapTupleIsValid(tuple))
 	{
@@ -1029,7 +1029,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
 						   ObjectIdEqualRegProcedure,
 						   ObjectIdGetDatum(clause_op));
 
-	scan = heap_beginscan(relation, false, NowTimeQual, 3, entry);
+	scan = heap_beginscan(relation, false, false, 3, entry);
 	tuple = heap_getnext(scan, false, (Buffer *) NULL);
 	if (!HeapTupleIsValid(tuple))
 	{
@@ -1061,7 +1061,7 @@ clause_pred_clause_test(Expr *predicate, Node *clause)
 						   Integer16EqualRegProcedure,
 						   Int16GetDatum(test_strategy));
 
-	scan = heap_beginscan(relation, false, NowTimeQual, 3, entry);
+	scan = heap_beginscan(relation, false, false, 3, entry);
 	tuple = heap_getnext(scan, false, (Buffer *) NULL);
 	if (!HeapTupleIsValid(tuple))
 	{
diff --git a/src/backend/optimizer/prep/archive.c b/src/backend/optimizer/prep/archive.c
deleted file mode 100644
index d053bd61a3d4d38c12eefd309223715123808838..0000000000000000000000000000000000000000
--- a/src/backend/optimizer/prep/archive.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * archive.c--
- *	  Support for planning scans on archived relations
- *
- * Copyright (c) 1994, Regents of the University of California
- *
- *
- * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/Attic/archive.c,v 1.4 1997/09/08 21:45:29 momjian Exp $
- *
- *-------------------------------------------------------------------------
- */
-#include <stdio.h>				/* for sprintf() */
-#include <sys/types.h>			/* for u_int in relcache.h */
-#include "postgres.h"
-
-#include "utils/rel.h"
-#include "utils/elog.h"
-#include "utils/palloc.h"
-#include "utils/relcache.h"
-#include "catalog/pg_class.h"
-#include "nodes/pg_list.h"
-#include "nodes/parsenodes.h"
-#include "optimizer/prep.h"
-#include "commands/creatinh.h"
-
-void
-plan_archive(List *rt)
-{
-	List	   *rtitem;
-	RangeTblEntry *rte;
-	TimeRange  *trange;
-	Relation	r;
-	Oid			reloid;
-
-	foreach(rtitem, rt)
-	{
-		rte = lfirst(rtitem);
-		trange = rte->timeRange;
-		if (trange)
-		{
-			reloid = rte->relid;
-			r = RelationIdGetRelation(reloid);
-			if (r->rd_rel->relarch != 'n')
-			{
-				rte->archive = true;
-			}
-		}
-	}
-}
-
-
-/*
- *	find_archive_rels -- Given a particular relid, find the archive
- *						 relation's relid.
- */
-List	   *
-find_archive_rels(Oid relid)
-{
-	Relation	arel;
-	char	   *arelName;
-
-	arelName = MakeArchiveName(relid);
-	arel = RelationNameGetRelation(arelName);
-	pfree(arelName);
-
-	return lconsi(arel->rd_id, lconsi(relid, NIL));
-}
diff --git a/src/backend/optimizer/prep/prepunion.c b/src/backend/optimizer/prep/prepunion.c
index aac995901f85bba1970c5e5e472c8c0bc16602b0..47036a22d7132befd1991bf33ff62e46b1718ec1 100644
--- a/src/backend/optimizer/prep/prepunion.c
+++ b/src/backend/optimizer/prep/prepunion.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.6 1997/09/08 21:45:37 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/prep/prepunion.c,v 1.7 1997/11/20 23:21:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -178,10 +178,6 @@ plan_union_queries(Index rt_index,
 			union_relids = VersionGetParents(rt_entry->relid);
 			break;
 
-		case ARCHIVE_FLAG:
-			union_relids = find_archive_rels(rt_entry->relid);
-			break;
-
 		default:
 			/* do nothing */
 			break;
diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c
index 6b4d5ee13dd0a07285b840e48640a2476b909ae3..15271d33b9b5c8d969f463b40b29cffbaa423aef 100644
--- a/src/backend/optimizer/util/plancat.c
+++ b/src/backend/optimizer/util/plancat.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.10 1997/09/18 20:20:50 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.11 1997/11/20 23:22:01 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -148,7 +148,7 @@ index_info(Query *root, bool first, int relid, IdxInfoRetval *info)
 							   ObjectIdGetDatum(indrelid));
 
 		relation = heap_openr(IndexRelationName);
-		scan = heap_beginscan(relation, 0, NowTimeQual,
+		scan = heap_beginscan(relation, 0, false,
 							  1, &indexKey);
 	}
 	if (!HeapScanIsValid(scan))
@@ -420,7 +420,7 @@ find_inheritance_children(Oid inhparent)
 
 	key[0].sk_argument = ObjectIdGetDatum((Oid) inhparent);
 	relation = heap_openr(InheritsRelationName);
-	scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+	scan = heap_beginscan(relation, 0, false, 1, key);
 	while (HeapTupleIsValid(inheritsTuple =
 							heap_getnext(scan, 0,
 										 (Buffer *) NULL)))
@@ -455,7 +455,7 @@ VersionGetParents(Oid verrelid)
 	fmgr_info(F_OIDEQ, &key[0].sk_func, &key[0].sk_nargs);
 	relation = heap_openr(VersionRelationName);
 	key[0].sk_argument = ObjectIdGetDatum(verrelid);
-	scan = heap_beginscan(relation, 0, NowTimeQual, 1, key);
+	scan = heap_beginscan(relation, 0, false, 1, key);
 	for (;;)
 	{
 		versionTuple = heap_getnext(scan, 0,
diff --git a/src/backend/parser/Makefile b/src/backend/parser/Makefile
index 5d48fbf0e797b69a24ccc4ccadd55e4098934abb..a66907dfc5831af4c0b1876df28fda76293fe0b7 100644
--- a/src/backend/parser/Makefile
+++ b/src/backend/parser/Makefile
@@ -4,7 +4,7 @@
 #    Makefile for parser
 #
 # IDENTIFICATION
-#    $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.9 1997/11/14 15:48:19 thomas Exp $
+#    $Header: /cvsroot/pgsql/src/backend/parser/Makefile,v 1.10 1997/11/20 23:22:05 momjian Exp $
 #
 #-------------------------------------------------------------------------
 
@@ -23,7 +23,7 @@ endif
 
 
 OBJS= analyze.o catalog_utils.o dbcommands.o gram.o \
-      keywords.o parser.o parse_query.o scan.o scansup.o sysfunc.o
+      keywords.o parser.o parse_query.o scan.o scansup.o
 
 all: SUBSYS.o
 
diff --git a/src/backend/parser/analyze.c b/src/backend/parser/analyze.c
index 202d5e6cb258d189bbdc953cf9e33bfaeacced71..bee5132a8b94062b434e62617b04a40f80236fde 100644
--- a/src/backend/parser/analyze.c
+++ b/src/backend/parser/analyze.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.48 1997/10/30 16:34:22 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/analyze.c,v 1.49 1997/11/20 23:22:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -21,6 +21,7 @@
 #include "nodes/parsenodes.h"
 #include "nodes/relation.h"
 #include "parse.h"				/* for AND, OR, etc. */
+#include "catalog/pg_aggregate.h"
 #include "catalog/pg_type.h"	/* for INT4OID, etc. */
 #include "catalog/pg_proc.h"
 #include "utils/elog.h"
@@ -66,33 +67,31 @@ static List *expandAllTables(ParseState *pstate);
 static char *figureColname(Node *expr, Node *resval);
 static List *makeTargetNames(ParseState *pstate, List *cols);
 static List *transformTargetList(ParseState *pstate, List *targetlist);
-static TargetEntry *
-make_targetlist_expr(ParseState *pstate,
+static TargetEntry *make_targetlist_expr(ParseState *pstate,
 					 char *colname, Node *expr,
 					 List *arrayRef);
 static bool inWhereClause = false;
 static Node *transformWhereClause(ParseState *pstate, Node *a_expr);
-static List *
-transformGroupClause(ParseState *pstate, List *grouplist,
+static List *transformGroupClause(ParseState *pstate, List *grouplist,
 					 List *targetlist);
-static List *
-transformSortClause(ParseState *pstate,
+static List *transformSortClause(ParseState *pstate,
 					List *orderlist, List *targetlist,
 					char *uniqueFlag);
 
 static void parseFromClause(ParseState *pstate, List *frmList);
-static Node *
-ParseFunc(ParseState *pstate, char *funcname,
+static Node *ParseFunc(ParseState *pstate, char *funcname,
 		  List *fargs, int *curr_resno);
 static List *setup_tlist(char *attname, Oid relid);
 static List *setup_base_tlist(Oid typeid);
-static void
-make_arguments(int nargs, List *fargs, Oid *input_typeids,
+static void make_arguments(int nargs, List *fargs, Oid *input_typeids,
 			   Oid *function_typeids);
 static void AddAggToParseState(ParseState *pstate, Aggreg *aggreg);
 static void finalizeAggregates(ParseState *pstate, Query *qry);
 static void parseCheckAggregates(ParseState *pstate, Query *qry);
 static ParseState *makeParseState(void);
+static Node *parser_typecast(Value *expr, TypeName *typename, int typlen);
+static Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen);
+static Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
 
 /*****************************************************************************
  *
@@ -464,9 +463,9 @@ transformRuleStmt(ParseState *pstate, RuleStmt *stmt)
 		 * equal to 2.
 		 */
 		addRangeTableEntry(pstate, stmt->object->relname, "*CURRENT*",
-						   FALSE, FALSE, NULL);
+						   FALSE, FALSE);
 		addRangeTableEntry(pstate, stmt->object->relname, "*NEW*",
-						   FALSE, FALSE, NULL);
+						   FALSE, FALSE);
 
 		pstate->p_last_resno = 1;
 		pstate->p_is_rule = true;		/* for expand all */
@@ -947,8 +946,7 @@ parseFromClause(ParseState *pstate, List *frmList)
 		 * eg. select * from foo f where f.x = 1; will generate wrong answer
 		 * if we expand * to foo.x.
 		 */
-		rte = addRangeTableEntry(pstate, relname, refname, baserel->inh, TRUE,
-								 baserel->timeRange);
+		rte = addRangeTableEntry(pstate, relname, refname, baserel->inh, TRUE);
 	}
 }
 
@@ -968,7 +966,7 @@ makeRangeTable(ParseState *pstate, char *relname, List *frmList)
 		return;
 
 	if (refnameRangeTablePosn(pstate->p_rtable, relname) < 1)
-		rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE, NULL);
+		rte = addRangeTableEntry(pstate, relname, relname, FALSE, FALSE);
 	else
 		rte = refnameRangeTableEntry(pstate->p_rtable, relname);
 
@@ -2321,7 +2319,7 @@ ParseFunc(ParseState *pstate, char *funcname, List *fargs, int *curr_resno)
 
 			rte = refnameRangeTableEntry(pstate->p_rtable, refname);
 			if (rte == NULL)
-				rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE, NULL);
+				rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE);
 
 			relname = rte->relname;
 			relid = rte->relid;
@@ -2443,7 +2441,7 @@ ParseFunc(ParseState *pstate, char *funcname, List *fargs, int *curr_resno)
 			rte = refnameRangeTableEntry(pstate->p_rtable, refname);
 			if (rte == NULL)
 				rte = addRangeTableEntry(pstate, refname, refname,
-										 FALSE, FALSE, NULL);
+										 FALSE, FALSE);
 			relname = rte->relname;
 
 			vnum = refnameRangeTablePosn(pstate->p_rtable, rte->refname);
@@ -2862,3 +2860,340 @@ parseCheckAggregates(ParseState *pstate, Query *qry)
  */
 	return;
 }
+
+/* not used
+#define    PSIZE(PTR)	   (*((int32 *)(PTR) - 1))
+*/
+
+static Node	   *
+parser_typecast(Value *expr, TypeName *typename, int typlen)
+{
+	/* check for passing non-ints */
+	Const	   *adt;
+	Datum		lcp;
+	Type		tp;
+	char		type_string[NAMEDATALEN];
+	int32		len;
+	char	   *cp = NULL;
+	char	   *const_string = NULL;
+	bool		string_palloced = false;
+
+	switch (nodeTag(expr))
+	{
+		case T_String:
+			const_string = DatumGetPointer(expr->val.str);
+			break;
+		case T_Integer:
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%ld", expr->val.ival);
+			break;
+		default:
+			elog(WARN,
+			"parser_typecast: cannot cast this expression to type \"%s\"",
+				 typename->name);
+	}
+
+	if (typename->arrayBounds != NIL)
+	{
+		sprintf(type_string, "_%s", typename->name);
+		tp = (Type) type(type_string);
+	}
+	else
+	{
+		tp = (Type) type(typename->name);
+	}
+
+	len = tlen(tp);
+
+#if 0							/* fix me */
+	switch (CInteger(lfirst(expr)))
+	{
+		case INT4OID:			/* int4 */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%d", ((Const *) lnext(expr))->constvalue);
+			break;
+
+		case NAMEOID:			/* char16 */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%s", ((Const *) lnext(expr))->constvalue);
+			break;
+
+		case CHAROID:			/* char */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%c", ((Const) lnext(expr))->constvalue);
+			break;
+
+		case FLOAT8OID: /* float8 */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%f", ((Const) lnext(expr))->constvalue);
+			break;
+
+		case CASHOID:			/* money */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%d",
+					(int) ((Const *) expr)->constvalue);
+			break;
+
+		case TEXTOID:			/* text */
+			const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
+			const_string = (char *) textout((struct varlena *) const_string);
+			break;
+
+		case UNKNOWNOID:		/* unknown */
+			const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
+			const_string = (char *) textout((struct varlena *) const_string);
+			break;
+
+		default:
+			elog(WARN, "unknown type %d", CInteger(lfirst(expr)));
+	}
+#endif
+
+	cp = instr2(tp, const_string, typlen);
+
+	if (!tbyvalue(tp))
+	{
+/*
+		if (len >= 0 && len != PSIZE(cp)) {
+			char *pp;
+			pp = (char *) palloc(len);
+			memmove(pp, cp, len);
+			cp = pp;
+		}
+*/
+		lcp = PointerGetDatum(cp);
+	}
+	else
+	{
+		switch (len)
+		{
+			case 1:
+				lcp = Int8GetDatum(cp);
+				break;
+			case 2:
+				lcp = Int16GetDatum(cp);
+				break;
+			case 4:
+				lcp = Int32GetDatum(cp);
+				break;
+			default:
+				lcp = PointerGetDatum(cp);
+				break;
+		}
+	}
+
+	adt = makeConst(typeid(tp),
+					len,
+					(Datum) lcp,
+					false,
+					tbyvalue(tp),
+					false,		/* not a set */
+					true /* is cast */ );
+
+	if (string_palloced)
+		pfree(const_string);
+
+	return (Node *) adt;
+}
+
+static Node	   *
+parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
+{
+	/* check for passing non-ints */
+	Const	   *adt;
+	Datum		lcp;
+	int32		len = tlen(tp);
+	char	   *cp = NULL;
+
+	char	   *const_string = NULL;
+	bool		string_palloced = false;
+
+	Assert(IsA(expr, Const));
+
+	switch (exprType)
+	{
+		case 0:			/* NULL */
+			break;
+		case INT4OID:			/* int4 */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%d",
+					(int) ((Const *) expr)->constvalue);
+			break;
+		case NAMEOID:			/* char16 */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%s",
+					(char *) ((Const *) expr)->constvalue);
+			break;
+		case CHAROID:			/* char */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%c",
+					(char) ((Const *) expr)->constvalue);
+			break;
+		case FLOAT4OID: /* float4 */
+			{
+				float32		floatVal =
+				DatumGetFloat32(((Const *) expr)->constvalue);
+
+				const_string = (char *) palloc(256);
+				string_palloced = true;
+				sprintf(const_string, "%f", *floatVal);
+				break;
+			}
+		case FLOAT8OID: /* float8 */
+			{
+				float64		floatVal =
+				DatumGetFloat64(((Const *) expr)->constvalue);
+
+				const_string = (char *) palloc(256);
+				string_palloced = true;
+				sprintf(const_string, "%f", *floatVal);
+				break;
+			}
+		case CASHOID:			/* money */
+			const_string = (char *) palloc(256);
+			string_palloced = true;
+			sprintf(const_string, "%ld",
+					(long) ((Const *) expr)->constvalue);
+			break;
+		case TEXTOID:			/* text */
+			const_string =
+				DatumGetPointer(((Const *) expr)->constvalue);
+			const_string = (char *) textout((struct varlena *) const_string);
+			break;
+		case UNKNOWNOID:		/* unknown */
+			const_string =
+				DatumGetPointer(((Const *) expr)->constvalue);
+			const_string = (char *) textout((struct varlena *) const_string);
+			break;
+		default:
+			elog(WARN, "unknown type %u ", exprType);
+	}
+
+	if (!exprType)
+	{
+		adt = makeConst(typeid(tp),
+						(Size) 0,
+						(Datum) NULL,
+						true,	/* isnull */
+						false,	/* was omitted */
+						false,	/* not a set */
+						true /* is cast */ );
+		return ((Node *) adt);
+	}
+
+	cp = instr2(tp, const_string, typlen);
+
+
+	if (!tbyvalue(tp))
+	{
+/*
+		if (len >= 0 && len != PSIZE(cp)) {
+			char *pp;
+			pp = (char *) palloc(len);
+			memmove(pp, cp, len);
+			cp = pp;
+		}
+*/
+		lcp = PointerGetDatum(cp);
+	}
+	else
+	{
+		switch (len)
+		{
+			case 1:
+				lcp = Int8GetDatum(cp);
+				break;
+			case 2:
+				lcp = Int16GetDatum(cp);
+				break;
+			case 4:
+				lcp = Int32GetDatum(cp);
+				break;
+			default:
+				lcp = PointerGetDatum(cp);
+				break;
+		}
+	}
+
+	adt = makeConst(typeid(tp),
+					(Size) len,
+					(Datum) lcp,
+					false,
+					false,		/* was omitted */
+					false,		/* not a set */
+					true /* is cast */ );
+
+	/*
+	 * printf("adt %s : %u %d %d\n",CString(expr),typeid(tp) , len,cp);
+	 */
+	if (string_palloced)
+		pfree(const_string);
+
+	return ((Node *) adt);
+}
+
+static Aggreg	   *
+ParseAgg(char *aggname, Oid basetype, Node *target)
+{
+	Oid			fintype;
+	Oid			vartype;
+	Oid			xfn1;
+	Form_pg_aggregate aggform;
+	Aggreg	   *aggreg;
+	HeapTuple	theAggTuple;
+
+	theAggTuple = SearchSysCacheTuple(AGGNAME, PointerGetDatum(aggname),
+									  ObjectIdGetDatum(basetype),
+									  0, 0);
+	if (!HeapTupleIsValid(theAggTuple))
+	{
+		elog(WARN, "aggregate %s does not exist", aggname);
+	}
+
+	aggform = (Form_pg_aggregate) GETSTRUCT(theAggTuple);
+	fintype = aggform->aggfinaltype;
+	xfn1 = aggform->aggtransfn1;
+
+	if (nodeTag(target) != T_Var && nodeTag(target) != T_Expr)
+		elog(WARN, "parser: aggregate can only be applied on an attribute or expression");
+
+	/* only aggregates with transfn1 need a base type */
+	if (OidIsValid(xfn1))
+	{
+		basetype = aggform->aggbasetype;
+		if (nodeTag(target) == T_Var)
+			vartype = ((Var *) target)->vartype;
+		else
+			vartype = ((Expr *) target)->typeOid;
+
+		if (basetype != vartype)
+		{
+			Type		tp1,
+						tp2;
+
+			tp1 = get_id_type(basetype);
+			tp2 = get_id_type(vartype);
+			elog(NOTICE, "Aggregate type mismatch:");
+			elog(WARN, "%s works on %s, not %s", aggname,
+				 tname(tp1), tname(tp2));
+		}
+	}
+
+	aggreg = makeNode(Aggreg);
+	aggreg->aggname = pstrdup(aggname);
+	aggreg->basetype = aggform->aggbasetype;
+	aggreg->aggtype = fintype;
+
+	aggreg->target = target;
+
+	return aggreg;
+}
diff --git a/src/backend/parser/catalog_utils.c b/src/backend/parser/catalog_utils.c
index e3784597732e71e9ae7f72b642a63967f34d91c1..b119c7dbb5a75ce4757bc167e62d762b538e0efc 100644
--- a/src/backend/parser/catalog_utils.c
+++ b/src/backend/parser/catalog_utils.c
@@ -6,7 +6,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.29 1997/11/02 15:25:19 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/catalog_utils.c,v 1.30 1997/11/20 23:22:14 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -347,7 +347,7 @@ binary_oper_get_candidates(char *opname,
 	pg_operator_desc = heap_openr(OperatorRelationName);
 	pg_operator_scan = heap_beginscan(pg_operator_desc,
 									  0,
-									  SelfTimeQual,
+									  true,
 									  nkeys,
 									  opKey);
 
@@ -642,7 +642,7 @@ unary_oper_get_candidates(char *op,
 	pg_operator_desc = heap_openr(OperatorRelationName);
 	pg_operator_scan = heap_beginscan(pg_operator_desc,
 									  0,
-									  SelfTimeQual,
+									  true,
 									  2,
 									  opKey);
 
@@ -1004,7 +1004,7 @@ func_get_candidates(char *funcname, int nargs)
 			ItemPointer iptr;
 
 			iptr = &indexRes->heap_iptr;
-			tuple = heap_fetch(heapRelation, NowTimeQual, iptr, &buffer);
+			tuple = heap_fetch(heapRelation, false, iptr, &buffer);
 			pfree(indexRes);
 			if (HeapTupleIsValid(tuple))
 			{
@@ -1352,7 +1352,7 @@ findsupers(Oid relid, Oid **supervec)
 							   ObjectIdEqualRegProcedure,
 							   ObjectIdGetDatum(relid));
 
-		inhscan = heap_beginscan(inhrel, 0, NowTimeQual, 1, &skey);
+		inhscan = heap_beginscan(inhrel, 0, false, 1, &skey);
 
 		while (HeapTupleIsValid(inhtup = heap_getnext(inhscan, 0, &buf)))
 		{
diff --git a/src/backend/parser/dbcommands.c b/src/backend/parser/dbcommands.c
index d3f3f23eab91e819e9e3f15dc00ced66c74fa82a..ab7044193d859c189261e5f8c028a8b29c683d2b 100644
--- a/src/backend/parser/dbcommands.c
+++ b/src/backend/parser/dbcommands.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.11 1997/11/10 15:17:44 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/dbcommands.c,v 1.12 1997/11/20 23:22:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -159,7 +159,7 @@ get_pg_dbtup(char *command, char *dbname, Relation dbrel)
 	ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
 						   NameEqualRegProcedure, NameGetDatum(dbname));
 
-	scan = heap_beginscan(dbrel, 0, NowTimeQual, 1, &scanKey);
+	scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
 	if (!HeapScanIsValid(scan))
 		elog(WARN, "%s: cannot begin scan of pg_database.", command);
 
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 333a42f55d5de129aee4a7f8f08751cea1ad72b5..915fca62c4f7182e7ce721bc257e2ea8aec77f35 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.68 1997/11/17 16:37:24 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.69 1997/11/20 23:22:19 momjian Exp $
  *
  * HISTORY
  *	  AUTHOR			DATE			MAJOR EVENT
@@ -95,7 +95,6 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
 	IndexElem			*ielem;
 	RangeVar			*range;
 	RelExpr				*relexp;
-	TimeRange			*trange;
 	A_Indices			*aind;
 	ResTarget			*target;
 	ParamNo				*paramno;
@@ -134,8 +133,7 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
 
 %type <str>		opt_id, opt_portal_name,
 		before_clause, after_clause, all_Op, MathOp, opt_name, opt_unique,
-		result, OptUseOp, opt_class, opt_range_start, opt_range_end,
-		SpecialRuleRelation
+		result, OptUseOp, opt_class, SpecialRuleRelation
 
 %type <str>		privileges, operation_commalist, grantee
 %type <chr>		operation, TriggerOneEvent
@@ -190,7 +188,6 @@ static Node *makeIndexable(char *opname, Node *lexpr, Node *rexpr);
 %type <ielem>	index_elem, func_index
 %type <range>	from_val
 %type <relexp>	relation_expr
-%type <trange>	time_range
 %type <target>	res_target_el, res_target_el2
 %type <paramno> ParamNo
 
@@ -2353,7 +2350,6 @@ relation_expr:	relation_name
 					$$ = makeNode(RelExpr);
 					$$->relname = $1;
 					$$->inh = FALSE;
-					$$->timeRange = NULL;
 				}
 		| relation_name '*'				  %prec '='
 				{
@@ -2361,44 +2357,7 @@ relation_expr:	relation_name
 					$$ = makeNode(RelExpr);
 					$$->relname = $1;
 					$$->inh = TRUE;
-					$$->timeRange = NULL;
 				}
-		| relation_name time_range
-				{
-					/* time-qualified query */
-					$$ = makeNode(RelExpr);
-					$$->relname = $1;
-					$$->inh = FALSE;
-					$$->timeRange = $2;
-				}
-		;
-
-/* Time travel
- * Range specification clause.
- */
-time_range:  '[' opt_range_start ',' opt_range_end ']'
-				{
-					$$ = makeNode(TimeRange);
-					$$->startDate = $2;
-					$$->endDate = $4;
-					elog (WARN, "time travel is no longer available");
-				}
-		| '[' date ']'
-				{
-					$$ = makeNode(TimeRange);
-					$$->startDate = $2;
-					$$->endDate = NULL;
-					elog (WARN, "time travel is no longer available");
-				}
-		;
-
-opt_range_start:  date
-		| /*EMPTY*/								{ $$ = "epoch"; }
-		;
-
-opt_range_end:	date
-		| /*EMPTY*/								{ $$ = "now"; }
-		;
 
 opt_array_bounds:  '[' ']' nest_array_bounds
 				{  $$ = lcons(makeInteger(-1), $3); }
diff --git a/src/backend/parser/parse_query.c b/src/backend/parser/parse_query.c
index 70f9763e024e30e28c4dc5fea7ced9c49217c04e..f23e0cff7444664ecc16c8a4d85d852b9275a9b3 100644
--- a/src/backend/parser/parse_query.c
+++ b/src/backend/parser/parse_query.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.22 1997/11/02 15:25:30 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/Attic/parse_query.c,v 1.23 1997/11/20 23:22:22 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -127,8 +127,8 @@ RangeTblEntry *
 addRangeTableEntry(ParseState *pstate,
 				   char *relname,
 				   char *refname,
-				   bool inh, bool inFromCl,
-				   TimeRange *timeRange)
+				   bool inh,
+				   bool inFromCl)
 {
 	Relation	relation;
 	RangeTblEntry *rte = makeNode(RangeTblEntry);
@@ -154,8 +154,6 @@ addRangeTableEntry(ParseState *pstate,
 	 */
 	rte->inh = inh;
 
-	rte->timeRange = timeRange;
-
 	/* RelOID */
 	rte->relid = RelationGetRelationId(relation);
 
@@ -194,7 +192,7 @@ expandAll(ParseState *pstate, char *relname, char *refname, int *this_resno)
 
 	rte = refnameRangeTableEntry(pstate->p_rtable, refname);
 	if (rte == NULL)
-		rte = addRangeTableEntry(pstate, relname, refname, FALSE, FALSE, NULL);
+		rte = addRangeTableEntry(pstate, relname, refname, FALSE, FALSE);
 
 	rdesc = heap_open(rte->relid);
 
@@ -475,7 +473,7 @@ make_var(ParseState *pstate, char *refname, char *attrname, Oid *type_id)
 
 	rte = refnameRangeTableEntry(pstate->p_rtable, refname);
 	if (rte == NULL)
-		rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE, NULL);
+		rte = addRangeTableEntry(pstate, refname, refname, FALSE, FALSE);
 
 	vnum = refnameRangeTablePosn(pstate->p_rtable, refname);
 
diff --git a/src/backend/parser/parser.c b/src/backend/parser/parser.c
index a70c90ea6c2ccff9f159e0118cbc08d2397e44ff..d658c30896c8c21451fee4c6f5ce5274f8d30fd9 100644
--- a/src/backend/parser/parser.c
+++ b/src/backend/parser/parser.c
@@ -6,45 +6,20 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.27 1997/11/17 16:59:08 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/parser.c,v 1.28 1997/11/20 23:22:24 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
 #include <string.h>
 #include <stdio.h>
-#include <pwd.h>
-#include <sys/param.h>			/* for MAXPATHLEN */
 
 #include "postgres.h"
-#include "parser/catalog_utils.h"
 #include "parser/gramparse.h"
 #include "parser/parse_query.h"
-#include "nodes/pg_list.h"
-#include "nodes/execnodes.h"
-#include "nodes/makefuncs.h"
-#include "nodes/primnodes.h"
-#include "nodes/plannodes.h"
-#include "nodes/relation.h"
-#include "utils/builtins.h"
-#include "utils/exc.h"
-#include "utils/excid.h"
-#include "utils/lsyscache.h"
 #include "utils/palloc.h"
-#include "utils/syscache.h"
-#include "catalog/pg_aggregate.h"
-#include "catalog/pg_type.h"
-#include "access/heapam.h"
-#include "optimizer/clauses.h"
-
-void		init_io();			/* from scan.l */
-void		parser_init(Oid *typev, int nargs); /* from gram.y */
-int			yyparse();			/* from gram.c */
 
 char	   *parseString;		/* the char* which holds the string to be
 								 * parsed */
-char	   *parseCh;			/* a pointer used during parsing to walk
-								 * down ParseString */
-
 List	   *parsetree = NIL;
 
 #ifdef SETS_FIXED
@@ -70,9 +45,7 @@ parser(char *str, Oid *typev, int nargs)
 
 	init_io();
 
-	/* Set things up to read from the string, if there is one */
-	parseString = (char *) palloc(strlen(str) + 1);
-	memmove(parseString, str, strlen(str) + 1);
+	parseString = pstrdup(str);
 
 	parser_init(typev, nargs);
 	yyresult = yyparse();
@@ -83,10 +56,8 @@ parser(char *str, Oid *typev, int nargs)
 
 	clearerr(stdin);
 
-	if (yyresult)
-	{							/* error */
+	if (yyresult)		/* error */
 		return ((QueryTreeList *) NULL);
-	}
 
 	queryList = parse_analyze(parsetree);
 
@@ -205,339 +176,3 @@ define_sets(Node *clause)
 
 #endif
 
-/* not used
-#define    PSIZE(PTR)	   (*((int32 *)(PTR) - 1))
-*/
-
-Node	   *
-parser_typecast(Value *expr, TypeName *typename, int typlen)
-{
-	/* check for passing non-ints */
-	Const	   *adt;
-	Datum		lcp;
-	Type		tp;
-	char		type_string[NAMEDATALEN];
-	int32		len;
-	char	   *cp = NULL;
-	char	   *const_string = NULL;
-	bool		string_palloced = false;
-
-	switch (nodeTag(expr))
-	{
-		case T_String:
-			const_string = DatumGetPointer(expr->val.str);
-			break;
-		case T_Integer:
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%ld", expr->val.ival);
-			break;
-		default:
-			elog(WARN,
-			"parser_typecast: cannot cast this expression to type \"%s\"",
-				 typename->name);
-	}
-
-	if (typename->arrayBounds != NIL)
-	{
-		sprintf(type_string, "_%s", typename->name);
-		tp = (Type) type(type_string);
-	}
-	else
-	{
-		tp = (Type) type(typename->name);
-	}
-
-	len = tlen(tp);
-
-#if 0							/* fix me */
-	switch (CInteger(lfirst(expr)))
-	{
-		case INT4OID:			/* int4 */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%d", ((Const *) lnext(expr))->constvalue);
-			break;
-
-		case NAMEOID:			/* char16 */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%s", ((Const *) lnext(expr))->constvalue);
-			break;
-
-		case CHAROID:			/* char */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%c", ((Const) lnext(expr))->constvalue);
-			break;
-
-		case FLOAT8OID: /* float8 */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%f", ((Const) lnext(expr))->constvalue);
-			break;
-
-		case CASHOID:			/* money */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%d",
-					(int) ((Const *) expr)->constvalue);
-			break;
-
-		case TEXTOID:			/* text */
-			const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
-			const_string = (char *) textout((struct varlena *) const_string);
-			break;
-
-		case UNKNOWNOID:		/* unknown */
-			const_string = DatumGetPointer(((Const) lnext(expr))->constvalue);
-			const_string = (char *) textout((struct varlena *) const_string);
-			break;
-
-		default:
-			elog(WARN, "unknown type %d", CInteger(lfirst(expr)));
-	}
-#endif
-
-	cp = instr2(tp, const_string, typlen);
-
-	if (!tbyvalue(tp))
-	{
-/*
-		if (len >= 0 && len != PSIZE(cp)) {
-			char *pp;
-			pp = (char *) palloc(len);
-			memmove(pp, cp, len);
-			cp = pp;
-		}
-*/
-		lcp = PointerGetDatum(cp);
-	}
-	else
-	{
-		switch (len)
-		{
-			case 1:
-				lcp = Int8GetDatum(cp);
-				break;
-			case 2:
-				lcp = Int16GetDatum(cp);
-				break;
-			case 4:
-				lcp = Int32GetDatum(cp);
-				break;
-			default:
-				lcp = PointerGetDatum(cp);
-				break;
-		}
-	}
-
-	adt = makeConst(typeid(tp),
-					len,
-					(Datum) lcp,
-					false,
-					tbyvalue(tp),
-					false,		/* not a set */
-					true /* is cast */ );
-
-	if (string_palloced)
-		pfree(const_string);
-
-	return (Node *) adt;
-}
-
-Node	   *
-parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen)
-{
-	/* check for passing non-ints */
-	Const	   *adt;
-	Datum		lcp;
-	int32		len = tlen(tp);
-	char	   *cp = NULL;
-
-	char	   *const_string = NULL;
-	bool		string_palloced = false;
-
-	Assert(IsA(expr, Const));
-
-	switch (exprType)
-	{
-		case 0:			/* NULL */
-			break;
-		case INT4OID:			/* int4 */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%d",
-					(int) ((Const *) expr)->constvalue);
-			break;
-		case NAMEOID:			/* char16 */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%s",
-					(char *) ((Const *) expr)->constvalue);
-			break;
-		case CHAROID:			/* char */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%c",
-					(char) ((Const *) expr)->constvalue);
-			break;
-		case FLOAT4OID: /* float4 */
-			{
-				float32		floatVal =
-				DatumGetFloat32(((Const *) expr)->constvalue);
-
-				const_string = (char *) palloc(256);
-				string_palloced = true;
-				sprintf(const_string, "%f", *floatVal);
-				break;
-			}
-		case FLOAT8OID: /* float8 */
-			{
-				float64		floatVal =
-				DatumGetFloat64(((Const *) expr)->constvalue);
-
-				const_string = (char *) palloc(256);
-				string_palloced = true;
-				sprintf(const_string, "%f", *floatVal);
-				break;
-			}
-		case CASHOID:			/* money */
-			const_string = (char *) palloc(256);
-			string_palloced = true;
-			sprintf(const_string, "%ld",
-					(long) ((Const *) expr)->constvalue);
-			break;
-		case TEXTOID:			/* text */
-			const_string =
-				DatumGetPointer(((Const *) expr)->constvalue);
-			const_string = (char *) textout((struct varlena *) const_string);
-			break;
-		case UNKNOWNOID:		/* unknown */
-			const_string =
-				DatumGetPointer(((Const *) expr)->constvalue);
-			const_string = (char *) textout((struct varlena *) const_string);
-			break;
-		default:
-			elog(WARN, "unknown type %u ", exprType);
-	}
-
-	if (!exprType)
-	{
-		adt = makeConst(typeid(tp),
-						(Size) 0,
-						(Datum) NULL,
-						true,	/* isnull */
-						false,	/* was omitted */
-						false,	/* not a set */
-						true /* is cast */ );
-		return ((Node *) adt);
-	}
-
-	cp = instr2(tp, const_string, typlen);
-
-
-	if (!tbyvalue(tp))
-	{
-/*
-		if (len >= 0 && len != PSIZE(cp)) {
-			char *pp;
-			pp = (char *) palloc(len);
-			memmove(pp, cp, len);
-			cp = pp;
-		}
-*/
-		lcp = PointerGetDatum(cp);
-	}
-	else
-	{
-		switch (len)
-		{
-			case 1:
-				lcp = Int8GetDatum(cp);
-				break;
-			case 2:
-				lcp = Int16GetDatum(cp);
-				break;
-			case 4:
-				lcp = Int32GetDatum(cp);
-				break;
-			default:
-				lcp = PointerGetDatum(cp);
-				break;
-		}
-	}
-
-	adt = makeConst(typeid(tp),
-					(Size) len,
-					(Datum) lcp,
-					false,
-					false,		/* was omitted */
-					false,		/* not a set */
-					true /* is cast */ );
-
-	/*
-	 * printf("adt %s : %u %d %d\n",CString(expr),typeid(tp) , len,cp);
-	 */
-	if (string_palloced)
-		pfree(const_string);
-
-	return ((Node *) adt);
-}
-
-Aggreg	   *
-ParseAgg(char *aggname, Oid basetype, Node *target)
-{
-	Oid			fintype;
-	Oid			vartype;
-	Oid			xfn1;
-	Form_pg_aggregate aggform;
-	Aggreg	   *aggreg;
-	HeapTuple	theAggTuple;
-
-	theAggTuple = SearchSysCacheTuple(AGGNAME, PointerGetDatum(aggname),
-									  ObjectIdGetDatum(basetype),
-									  0, 0);
-	if (!HeapTupleIsValid(theAggTuple))
-	{
-		elog(WARN, "aggregate %s does not exist", aggname);
-	}
-
-	aggform = (Form_pg_aggregate) GETSTRUCT(theAggTuple);
-	fintype = aggform->aggfinaltype;
-	xfn1 = aggform->aggtransfn1;
-
-	if (nodeTag(target) != T_Var && nodeTag(target) != T_Expr)
-		elog(WARN, "parser: aggregate can only be applied on an attribute or expression");
-
-	/* only aggregates with transfn1 need a base type */
-	if (OidIsValid(xfn1))
-	{
-		basetype = aggform->aggbasetype;
-		if (nodeTag(target) == T_Var)
-			vartype = ((Var *) target)->vartype;
-		else
-			vartype = ((Expr *) target)->typeOid;
-
-		if (basetype != vartype)
-		{
-			Type		tp1,
-						tp2;
-
-			tp1 = get_id_type(basetype);
-			tp2 = get_id_type(vartype);
-			elog(NOTICE, "Aggregate type mismatch:");
-			elog(WARN, "%s works on %s, not %s", aggname,
-				 tname(tp1), tname(tp2));
-		}
-	}
-
-	aggreg = makeNode(Aggreg);
-	aggreg->aggname = pstrdup(aggname);
-	aggreg->basetype = aggform->aggbasetype;
-	aggreg->aggtype = fintype;
-
-	aggreg->target = target;
-
-	return aggreg;
-}
diff --git a/src/backend/parser/scan.l b/src/backend/parser/scan.l
index 5b85598f87b1b3e0a1e01f1e76cba6024ae6f6e8..daa2faa9d562e672862c5106bb986f6736b92468 100644
--- a/src/backend/parser/scan.l
+++ b/src/backend/parser/scan.l
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.29 1997/11/17 16:31:39 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/parser/scan.l,v 1.30 1997/11/20 23:22:25 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,12 +29,11 @@
 #include "parser/gramparse.h"
 #include "parser/keywords.h"
 #include "parser/scansup.h"
-#include "parser/sysfunc.h"
 #include "parse.h"
 #include "utils/builtins.h"
 
 extern char *parseString;
-extern char *parseCh;
+static char *parseCh;
 
 /* some versions of lex define this as a macro */
 #if defined(yywrap)
@@ -127,8 +126,6 @@ number			[-+.0-9Ee]
 letter			[\200-\377_A-Za-z]
 letter_or_digit	[\200-\377_A-Za-z0-9]
 
-sysfunc			SYS_{letter}{letter_or_digit}*
-
 identifier		{letter}{letter_or_digit}*
 
 typecast		"::"
@@ -278,11 +275,6 @@ other			.
 				}
 
 
-{sysfunc}		{
-						yylval.str = pstrdup(SystemFunctionHandler((char *)yytext));
-						return (SCONST);
-				}
-
 {typecast}		{ return TYPECAST; }
 
 {self}/-[\.0-9]	{
diff --git a/src/backend/parser/sysfunc.c b/src/backend/parser/sysfunc.c
deleted file mode 100644
index f65f9b863ed3773e0806ea90b86547b78517346f..0000000000000000000000000000000000000000
--- a/src/backend/parser/sysfunc.c
+++ /dev/null
@@ -1,86 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * sysfunc.c--
- *	  process system functions and return a string result
- *
- * Notes:
- * 1) I return a string result because most of the functions cannot return any
- *	  normal type anyway (e.g. SYS_DATE, SYS_TIME, etc...), and the few that
- *	  might (SYS_UID or whatever) can just return it as a string - no problem.
- *	  This keeps the function flexible enough to be of good use.
- *
- * Written by Chad Robinson, chadr@brttech.com
- * Last modified: 04/27/1996
- * -------------------------------------------------------------------------
- */
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include <config.h>
-#include <postgres.h>
-#include <miscadmin.h>
-#include <parser/sysfunc.h>
-
-/*
- * Can't get much more obvious than this.  Might need to replace localtime()
- * on older systems...
- */
-static char *
-Sysfunc_system_date(void)
-{
-	time_t		cur_time_secs;
-	struct tm  *cur_time_expanded;
-	static char buf[12];		/* Just for safety, y'understand... */
-
-	time(&cur_time_secs);
-	cur_time_expanded = localtime(&cur_time_secs);
-	if (EuroDates == 1)
-		sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mday,
-		cur_time_expanded->tm_mon + 1, cur_time_expanded->tm_year + 1900);
-	else
-		sprintf(buf, "%2.2d-%2.2d-%4.4d", cur_time_expanded->tm_mon + 1,
-		  cur_time_expanded->tm_mday, cur_time_expanded->tm_year + 1900);
-
-	return &buf[0];
-}
-
-static char *
-Sysfunc_system_time(void)
-{
-	time_t		cur_time_secs;
-	struct tm  *cur_time_expanded;
-	static char buf[10];		/* Just for safety, y'understand... */
-
-	time(&cur_time_secs);
-	cur_time_expanded = localtime(&cur_time_secs);
-	sprintf(buf, "%2.2d:%2.2d:%2.2d", cur_time_expanded->tm_hour,
-			cur_time_expanded->tm_min, cur_time_expanded->tm_sec);
-
-	return &buf[0];
-}
-
-char	   *
-SystemFunctionHandler(char *funct)
-{
-	if (!strcmp(funct, "SYS_DATE"))
-		return Sysfunc_system_date();
-	if (!strcmp(funct, "SYS_TIME"))
-		return Sysfunc_system_time();
-	return "*unknown function*";
-}
-
-#ifdef SYSFUNC_TEST
-/*
- * Chad's rule of coding #4 - never delete a test function, even a stupid
- * one - you always need it 10 minutes after you delete it.
- */
-void
-main(void)
-{
-	printf("Current system date: %s\n", SystemFunctionHandler("SYS_DATE"));
-	return;
-}
-
-#endif
diff --git a/src/backend/rewrite/rewriteRemove.c b/src/backend/rewrite/rewriteRemove.c
index d14fd8b5ae64f5ed4eba961ce3de5cd5e055561b..a7c3552582a1fd82460f5cb08d2540c35c1a1b4c 100644
--- a/src/backend/rewrite/rewriteRemove.c
+++ b/src/backend/rewrite/rewriteRemove.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.5 1997/09/12 04:08:06 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteRemove.c,v 1.6 1997/11/20 23:22:37 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -90,7 +90,7 @@ RemoveRewriteRule(char *ruleName)
 	ScanKeyEntryInitialize(&scanKeyData, 0, Anum_pg_rewrite_rulename,
 						   F_CHAR16EQ, NameGetDatum(ruleName));
 	scanDesc = heap_beginscan(RewriteRelation,
-							  0, NowTimeQual, 1, &scanKeyData);
+							  0, false, 1, &scanKeyData);
 
 	tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
 
@@ -165,7 +165,7 @@ RelationRemoveRules(Oid relid)
 						   F_OIDEQ,
 						   ObjectIdGetDatum(relid));
 	scanDesc = heap_beginscan(RewriteRelation,
-							  0, NowTimeQual, 1, &scanKeyData);
+							  0, false, 1, &scanKeyData);
 
 	for (;;)
 	{
diff --git a/src/backend/rewrite/rewriteSupport.c b/src/backend/rewrite/rewriteSupport.c
index e75232dff238045adf8a1ce1dd439f3583b687d1..814f84271b04d8d5bd679074de7e3aadaf1f4de1 100644
--- a/src/backend/rewrite/rewriteSupport.c
+++ b/src/backend/rewrite/rewriteSupport.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.11 1997/10/25 05:35:55 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/rewrite/rewriteSupport.c,v 1.12 1997/11/20 23:22:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -109,7 +109,7 @@ IsDefinedRewriteRule(char *ruleName)
 	ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_rewrite_rulename,
 					   NameEqualRegProcedure, PointerGetDatum(ruleName));
 	scanDesc = heap_beginscan(RewriteRelation,
-							  0, NowTimeQual, 1, &scanKey);
+							  0, false, 1, &scanKey);
 
 	tuple = heap_getnext(scanDesc, 0, (Buffer *) NULL);
 
diff --git a/src/backend/storage/large_object/inv_api.c b/src/backend/storage/large_object/inv_api.c
index 7b89ad9569ab191695eb0e7a35b7d7fb9f8d825b..7c3c7c5e3f03f590299c19cf19ebe63524660d58 100644
--- a/src/backend/storage/large_object/inv_api.c
+++ b/src/backend/storage/large_object/inv_api.c
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.19 1997/11/02 15:25:40 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.20 1997/11/20 23:22:46 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -628,7 +628,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP)
 			 * a time qual in.
 			 */
 
-			htup = heap_fetch(obj_desc->heap_r, NowTimeQual,
+			htup = heap_fetch(obj_desc->heap_r, false,
 							  &(res->heap_iptr), bufP);
 
 		} while (htup == (HeapTuple) NULL);
@@ -639,7 +639,7 @@ inv_fetchtup(LargeObjectDesc *obj_desc, Buffer *bufP)
 	}
 	else
 	{
-		htup = heap_fetch(obj_desc->heap_r, NowTimeQual,
+		htup = heap_fetch(obj_desc->heap_r, false,
 						  &(obj_desc->htid), bufP);
 	}
 
@@ -1206,7 +1206,7 @@ _inv_getsize(Relation hreln, TupleDesc hdesc, Relation ireln)
 		if (buf != InvalidBuffer)
 			ReleaseBuffer(buf);
 
-		htup = heap_fetch(hreln, NowTimeQual, &(res->heap_iptr), &buf);
+		htup = heap_fetch(hreln, false, &(res->heap_iptr), &buf);
 
 	} while (!HeapTupleIsValid(htup));
 
diff --git a/src/backend/tcop/aclchk.c b/src/backend/tcop/aclchk.c
index d1525b2b152d491825d421ec5d6e5b71dbd59261..f37c38476a31b20e6bd92beb3bdf72a63ec2a4c2 100644
--- a/src/backend/tcop/aclchk.c
+++ b/src/backend/tcop/aclchk.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.17 1997/09/08 21:47:48 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/tcop/Attic/aclchk.c,v 1.18 1997/11/20 23:22:50 momjian Exp $
  *
  * NOTES
  *	  See acl.h.
@@ -123,7 +123,7 @@ ChangeAcl(char *relname,
 	relkey[0].sk_argument = NameGetDatum(relname);
 	hsdp = heap_beginscan(relation,
 						  0,
-						  NowTimeQual,
+						  false,
 						  (unsigned) 1,
 						  relkey);
 	htp = heap_getnext(hsdp, 0, &buffer);
@@ -491,7 +491,7 @@ pg_aclcheck(char *relname, char *usename, AclMode mode)
 				  &relkey[0].sk_func,
 				  &relkey[0].sk_nargs);
 		relkey[0].sk_argument = NameGetDatum(relname);
-		hsdp = heap_beginscan(relation, 0, NowTimeQual, 1, relkey);
+		hsdp = heap_beginscan(relation, 0, false, 1, relkey);
 		htp = heap_getnext(hsdp, 0, (Buffer *) 0);
 		if (HeapTupleIsValid(htp) &&
 			!heap_attisnull(htp, Anum_pg_class_relacl))
diff --git a/src/backend/utils/adt/not_in.c b/src/backend/utils/adt/not_in.c
index dd11e8389b01dfaebd1153f2fe1d7ea8ee79ecbe..06492652aef15b81308899abaff2d3d5b3e1d1dc 100644
--- a/src/backend/utils/adt/not_in.c
+++ b/src/backend/utils/adt/not_in.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.6 1997/09/12 04:08:21 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/not_in.c,v 1.7 1997/11/20 23:22:57 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -72,7 +72,7 @@ int4notin(int16 not_in_arg, char *relation_and_attr)
 	/* the last argument should be a ScanKey, not an integer! - jolly */
 	/* it looks like the arguments are out of order, too */
 	/* but skeyData is never initialized! does this work?? - ay 2/95 */
-	scan_descriptor = heap_beginscan(relation_to_scan, false, NULL, 0,
+	scan_descriptor = heap_beginscan(relation_to_scan, false, false, 0,
 									 &skeyData);
 
 	retval = true;
diff --git a/src/backend/utils/adt/regproc.c b/src/backend/utils/adt/regproc.c
index 025597ddc857d6fc7d6fb53cdc114194d21cde03..bc090184de6390c4730ceebdea39b92d8f7e01f4 100644
--- a/src/backend/utils/adt/regproc.c
+++ b/src/backend/utils/adt/regproc.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.9 1997/11/15 16:32:01 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/regproc.c,v 1.10 1997/11/20 23:23:00 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -55,7 +55,7 @@ regprocin(char *proname)
 						   (RegProcedure) F_CHAR16EQ,
 						   (Datum) proname);
 
-	procscan = heap_beginscan(proc, 0, NowTimeQual, 1, &key);
+	procscan = heap_beginscan(proc, 0, false, 1, &key);
 	if (!HeapScanIsValid(procscan))
 	{
 		heap_close(proc);
@@ -114,7 +114,7 @@ regprocout(RegProcedure proid)
 						   (RegProcedure) F_INT4EQ,
 						   (Datum) proid);
 
-	procscan = heap_beginscan(proc, 0, NowTimeQual, 1, &key);
+	procscan = heap_beginscan(proc, 0, false, 1, &key);
 	if (!HeapScanIsValid(procscan))
 	{
 		heap_close(proc);
@@ -192,7 +192,7 @@ oid8types(Oid (*oidArray)[])
 								   (RegProcedure) F_INT4EQ,
 								   (Datum) *sp);
 		
-			typescan = heap_beginscan(type, 0, NowTimeQual, 1, &key);
+			typescan = heap_beginscan(type, 0, false, 1, &key);
 			if (!HeapScanIsValid(typescan))
 			{
 				heap_close(type);
diff --git a/src/backend/utils/adt/selfuncs.c b/src/backend/utils/adt/selfuncs.c
index e58bdf11b8f506a82ef2bc7126c07a913146b150..c16e2e4493714e1ecb5db44bb822b9f35796231a 100644
--- a/src/backend/utils/adt/selfuncs.c
+++ b/src/backend/utils/adt/selfuncs.c
@@ -12,7 +12,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.10 1997/09/08 02:31:00 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/selfuncs.c,v 1.11 1997/11/20 23:23:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -350,7 +350,7 @@ gethilokey(Oid relid,
 	key[0].sk_argument = ObjectIdGetDatum(relid);
 	key[1].sk_argument = Int16GetDatum((int16) attnum);
 	key[2].sk_argument = ObjectIdGetDatum(opid);
-	sdesc = heap_beginscan(rdesc, 0, NowTimeQual, 3, key);
+	sdesc = heap_beginscan(rdesc, 0, false, 3, key);
 	tuple = heap_getnext(sdesc, 0, (Buffer *) NULL);
 	if (!HeapTupleIsValid(tuple))
 	{
diff --git a/src/backend/utils/adt/sets.c b/src/backend/utils/adt/sets.c
index 70bfecc9774caf093fdb99aa602c94fb1492bd96..4340baa2eb5c2f0bc672a5b965e716e4d3e6610c 100644
--- a/src/backend/utils/adt/sets.c
+++ b/src/backend/utils/adt/sets.c
@@ -9,7 +9,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.7 1997/09/08 02:31:01 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/adt/Attic/sets.c,v 1.8 1997/11/20 23:23:05 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -121,7 +121,7 @@ SetDefine(char *querystr, char *typename)
 		oidKey[0].sk_argument = ObjectIdGetDatum(setoid);
 		pg_proc_scan = heap_beginscan(procrel,
 									  0,
-									  SelfTimeQual,
+									  true,
 									  1,
 									  oidKey);
 		tup = heap_getnext(pg_proc_scan, 0, &buffer);
diff --git a/src/backend/utils/cache/catcache.c b/src/backend/utils/cache/catcache.c
index f63f22df0f24b422bd6fcfff63babe09232fe4f7..535250e69b113a802ab69da0773fad7a3bd3798c 100644
--- a/src/backend/utils/cache/catcache.c
+++ b/src/backend/utils/cache/catcache.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.16 1997/09/18 20:22:18 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/catcache.c,v 1.17 1997/11/20 23:23:08 momjian Exp $
  *
  * Notes:
  *		XXX This needs to use exception.h to handle recovery when
@@ -973,7 +973,7 @@ SearchSysCache(struct catcache * cache,
 		 */
 		MemoryContextSwitchTo(oldcxt);
 
-		sd = heap_beginscan(relation, 0, NowTimeQual,
+		sd = heap_beginscan(relation, 0, false,
 							cache->cc_nkeys, cache->cc_skey);
 
 		/* should this buffer be ReleaseBuffer'd?  --djm 8/20/96 */
diff --git a/src/backend/utils/cache/relcache.c b/src/backend/utils/cache/relcache.c
index 046cba3458610d9f2303899ccb3baecfad098f3d..98a2a8484adce00011608d262c9195b0fe25fe1d 100644
--- a/src/backend/utils/cache/relcache.c
+++ b/src/backend/utils/cache/relcache.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.28 1997/11/17 16:59:25 momjian Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/cache/relcache.c,v 1.29 1997/11/20 23:23:11 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -383,7 +383,7 @@ scan_pg_rel_seq(RelationBuildDescInfo buildinfo)
 	if (!IsInitProcessingMode())
 		RelationSetLockForRead(pg_class_desc);
 	pg_class_scan =
-		heap_beginscan(pg_class_desc, 0, NowTimeQual, 1, &key);
+		heap_beginscan(pg_class_desc, 0, false, 1, &key);
 	pg_class_tuple = heap_getnext(pg_class_scan, 0, &buf);
 
 	/* ----------------
@@ -555,7 +555,7 @@ build_tupdesc_seq(RelationBuildDescInfo buildinfo,
 	 */
 	pg_attribute_desc = heap_openr(AttributeRelationName);
 	pg_attribute_scan =
-		heap_beginscan(pg_attribute_desc, 0, NowTimeQual, 1, &key);
+		heap_beginscan(pg_attribute_desc, 0, false, 1, &key);
 
 	/* ----------------
 	 *	add attribute data to relation->rd_att
@@ -726,7 +726,7 @@ RelationBuildRuleLock(Relation relation)
 	 */
 	pg_rewrite_desc = heap_openr(RewriteRelationName);
 	pg_rewrite_scan =
-		heap_beginscan(pg_rewrite_desc, 0, NowTimeQual, 1, &key);
+		heap_beginscan(pg_rewrite_desc, 0, false, 1, &key);
 	pg_rewrite_tupdesc =
 		RelationGetTupleDescriptor(pg_rewrite_desc);
 
@@ -1728,7 +1728,7 @@ AttrDefaultFetch(Relation relation)
 			break;
 
 		iptr = &indexRes->heap_iptr;
-		tuple = heap_fetch(adrel, NowTimeQual, iptr, &buffer);
+		tuple = heap_fetch(adrel, false, iptr, &buffer);
 		pfree(indexRes);
 		if (!HeapTupleIsValid(tuple))
 			continue;
@@ -1817,7 +1817,7 @@ RelCheckFetch(Relation relation)
 			break;
 
 		iptr = &indexRes->heap_iptr;
-		tuple = heap_fetch(rcrel, NowTimeQual, iptr, &buffer);
+		tuple = heap_fetch(rcrel, false, iptr, &buffer);
 		pfree(indexRes);
 		if (!HeapTupleIsValid(tuple))
 			continue;
diff --git a/src/backend/utils/misc/database.c b/src/backend/utils/misc/database.c
index 461ec04469022ef4c3d10c7022224eda9d871f5c..11c4c99072d743ec571060fddbb9f8804d891614 100644
--- a/src/backend/utils/misc/database.c
+++ b/src/backend/utils/misc/database.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.2 1997/11/10 15:14:34 thomas Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/misc/Attic/database.c,v 1.3 1997/11/20 23:23:16 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -59,7 +59,7 @@ GetDatabaseInfo(char *name, Oid *owner, char *path)
 	ScanKeyEntryInitialize(&scanKey, 0, Anum_pg_database_datname,
 		NameEqualRegProcedure, NameGetDatum(name));
 
-	scan = heap_beginscan(dbrel, 0, NowTimeQual, 1, &scanKey);
+	scan = heap_beginscan(dbrel, 0, false, 1, &scanKey);
 	if (!HeapScanIsValid(scan))
 		elog(WARN, "GetDatabaseInfo: cannot begin scan of %s", DatabaseRelationName);
 
diff --git a/src/backend/utils/time/tqual.c b/src/backend/utils/time/tqual.c
index 756d3efff91d17c3c7501f7324978d672cb729c2..23a21d4071d1e259388a977f2c9defcb4686d960 100644
--- a/src/backend/utils/time/tqual.c
+++ b/src/backend/utils/time/tqual.c
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *	  $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.9 1997/11/02 15:26:17 vadim Exp $
+ *	  $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.10 1997/11/20 23:23:20 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -25,9 +25,6 @@
 
 #include "utils/tqual.h"
 
-static int4	SelfTimeQualData;
-TimeQual	SelfTimeQual = (TimeQual) &SelfTimeQualData;
-
 extern bool PostgresIsInitialized;
 
 /*
@@ -82,33 +79,23 @@ static bool HeapTupleSatisfiesItself(HeapTuple tuple);
 static bool HeapTupleSatisfiesNow(HeapTuple tuple);
 
 /*
- * HeapTupleSatisfiesTimeQual --
+ * HeapTupleSatisfiesScope --
  *		True iff heap tuple satsifies a time qual.
  *
  * Note:
  *		Assumes heap tuple is valid.
- *		Assumes time qual is valid.
  */
 bool
-HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual)
+HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself)
 {
 
 	if (TransactionIdEquals(tuple->t_xmax, AmiTransactionId))
 		return (false);
 
-	if (qual == SelfTimeQual || heapisoverride())
-	{
+	if (seeself == true || heapisoverride())
 		return (HeapTupleSatisfiesItself(tuple));
-	}
-
-	if (qual == NowTimeQual)
-	{
+	else
 		return (HeapTupleSatisfiesNow(tuple));
-	}
-
-	elog(WARN, "HeapTupleSatisfiesTimeQual: illegal time qual");
-
-	return (false);
 }
 
 /*
diff --git a/src/include/access/heapam.h b/src/include/access/heapam.h
index a66fcab073a25082c30c1660aff4e68e9f2e9cb0..cb9a0a889fc5c2bca2f209f97f2ea750b2585057 100644
--- a/src/include/access/heapam.h
+++ b/src/include/access/heapam.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: heapam.h,v 1.21 1997/11/02 15:26:37 vadim Exp $
+ * $Id: heapam.h,v 1.22 1997/11/20 23:23:31 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -123,13 +123,12 @@ extern Relation heap_openr(char *relationName);
 extern void heap_close(Relation relation);
 extern HeapScanDesc
 heap_beginscan(Relation relation, int atend,
-			   TimeQual timeQual, unsigned nkeys, ScanKey key);
+			   bool seeself, unsigned nkeys, ScanKey key);
 extern void heap_rescan(HeapScanDesc sdesc, bool scanFromEnd, ScanKey key);
 extern void heap_endscan(HeapScanDesc sdesc);
 extern HeapTuple heap_getnext(HeapScanDesc scandesc, int backw, Buffer *b);
 extern HeapTuple
-heap_fetch(Relation relation, TimeQual timeQual,
-		   ItemPointer tid, Buffer *b);
+heap_fetch(Relation relation, bool seeself, ItemPointer tid, Buffer *b);
 extern Oid	heap_insert(Relation relation, HeapTuple tup);
 extern int	heap_delete(Relation relation, ItemPointer tid);
 extern int
diff --git a/src/include/access/relscan.h b/src/include/access/relscan.h
index 8b2eb5ed0d0914fe2e6d0e888056a8c34e5f1e38..78c91dd2508add52c3df62145b2927669a8797b3 100644
--- a/src/include/access/relscan.h
+++ b/src/include/access/relscan.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: relscan.h,v 1.8 1997/09/08 21:50:56 momjian Exp $
+ * $Id: relscan.h,v 1.9 1997/11/20 23:23:33 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -33,7 +33,7 @@ typedef struct HeapScanDescData
 	ItemPointerData rs_mntid;	/* marked next tid */
 	ItemPointerData rs_mcd;		/* marked current delta XXX ??? */
 	bool		rs_atend;		/* restart scan at end? */
-	TimeQual	rs_tr;			/* time qualification */
+	bool		rs_seeself;		/* see self or not */
 	uint16		rs_cdelta;		/* current delta in chain */
 	uint16		rs_nkeys;		/* number of attributes in keys */
 	ScanKey		rs_key;			/* key descriptors */
diff --git a/src/include/access/valid.h b/src/include/access/valid.h
index d7707fa495bdd7a579462bcb7256fbe0443575ee..fec88923dbbab88598e852c9ad34dc5225334fc2 100644
--- a/src/include/access/valid.h
+++ b/src/include/access/valid.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: valid.h,v 1.9 1997/11/02 15:26:46 vadim Exp $
+ * $Id: valid.h,v 1.10 1997/11/20 23:23:35 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -113,7 +113,7 @@ do \
 						   relation, \
 						   buffer, \
 						   disk_page, \
-						   qual, \
+						   seeself, \
 						   nKeys, \
 						   key, \
 						   result) \
@@ -144,7 +144,7 @@ do \
 			{ \
 				uint16	_infomask = _tuple->t_infomask; \
 				\
-				_res = HeapTupleSatisfiesTimeQual(_tuple, (qual)); \
+				_res = HeapTupleSatisfiesVisibility(_tuple, (seeself)); \
 				if (_tuple->t_infomask != _infomask) \
 					SetBufferCommitInfoNeedsSave(buffer); \
 				if (_res) \
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h
index 08a5f4d3818f814670313f4a84f78965a049a71f..0e20bda73ef22f865527dcda5683332f622b1e8f 100644
--- a/src/include/executor/executor.h
+++ b/src/include/executor/executor.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: executor.h,v 1.14 1997/09/27 14:37:21 momjian Exp $
+ * $Id: executor.h,v 1.15 1997/11/20 23:23:39 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -28,8 +28,8 @@
  */
 extern void
 ExecOpenScanR(Oid relOid, int nkeys, ScanKey skeys, bool isindex,
-			  ScanDirection dir, TimeQual timeRange,
-			  Relation *returnRelation, Pointer *returnScanDesc);
+			  ScanDirection dir, Relation *returnRelation,
+			  Pointer *returnScanDesc);
 extern void ExecCloseR(Plan *node);
 extern void ExecReScan(Plan *node, ExprContext *exprCtxt, Plan *parent);
 extern HeapScanDesc
diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h
index 6fd9631f67b97826f6ef7be82cc9bbef0c653ed6..30625da1dafb600f349a24d9efe0d6263d7becc0 100644
--- a/src/include/nodes/parsenodes.h
+++ b/src/include/nodes/parsenodes.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parsenodes.h,v 1.30 1997/11/07 06:38:38 thomas Exp $
+ * $Id: parsenodes.h,v 1.31 1997/11/20 23:23:44 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -785,16 +785,6 @@ typedef struct ParamString
 	char	   *val;
 }			ParamString;
 
-/*
- * TimeRange - specifies a time range
- */
-typedef struct TimeRange
-{
-	NodeTag		type;
-	char	   *startDate;
-	char	   *endDate;		/* snapshot if NULL */
-}			TimeRange;
-
 /*
  * RelExpr - relation expressions
  */
@@ -803,7 +793,6 @@ typedef struct RelExpr
 	NodeTag		type;
 	char	   *relname;		/* the relation name */
 	bool		inh;			/* inheritance query */
-	TimeRange  *timeRange;		/* the time range */
 }			RelExpr;
 
 /*
@@ -887,14 +876,12 @@ typedef struct RangeTblEntry
 {
 	NodeTag		type;
 	char	   *relname;		/* real name of the relation */
-	TimeRange  *timeRange;		/* time range */
 	char	   *refname;		/* the reference name (specified in the
 								 * from clause) */
 	Oid			relid;
 	bool		inh;			/* inheritance? */
 	bool		archive;		/* filled in by plan_archive */
 	bool		inFromCl;		/* comes from From Clause */
-	TimeQual	timeQual;		/* filled in by pg_plan */
 }			RangeTblEntry;
 
 /*
diff --git a/src/include/optimizer/prep.h b/src/include/optimizer/prep.h
index 69db9b61ce5a90224bcec030be2705e8a7d4766a..ca42b88dff1ecabba96812dbf7285fccba8e8a22 100644
--- a/src/include/optimizer/prep.h
+++ b/src/include/optimizer/prep.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: prep.h,v 1.5 1997/09/08 21:53:30 momjian Exp $
+ * $Id: prep.h,v 1.6 1997/11/20 23:23:48 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -16,12 +16,6 @@
 #include <nodes/plannodes.h>
 #include <nodes/parsenodes.h>
 
-/*
- * prototypes for archive.h
- */
-extern void plan_archive(List *rt);
-extern List *find_archive_rels(Oid relid);
-
 /*
  * prototypes for prepqual.h
  */
diff --git a/src/include/parser/parse_query.h b/src/include/parser/parse_query.h
index fbc06f2d7b0a747f337dfc1cffe288c19ffdd3c2..0a7d534b85b81ce3b46e3d6b3733f4a315cef499 100644
--- a/src/include/parser/parse_query.h
+++ b/src/include/parser/parse_query.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: parse_query.h,v 1.13 1997/11/02 15:27:08 vadim Exp $
+ * $Id: parse_query.h,v 1.14 1997/11/20 23:23:53 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -29,8 +29,7 @@ extern int	refnameRangeTablePosn(List *rtable, char *refname);
 extern RangeTblEntry *
 addRangeTableEntry(ParseState *pstate,
 				   char *relname, char *refname,
-				   bool inh, bool inFromCl,
-				   TimeRange *timeRange);
+				   bool inh, bool inFromCl);
 extern List *
 expandAll(ParseState *pstate, char *relname, char *refname,
 		  int *this_resno);
@@ -49,13 +48,9 @@ extern Const *make_const(Value *value);
 extern void param_type_init(Oid *typev, int nargs);
 extern Oid	param_type(int t);
 
-/* parser.c (was ylib.c) */
 extern QueryTreeList *parser(char *str, Oid *typev, int nargs);
-extern Node *parser_typecast(Value *expr, TypeName *typename, int typlen);
-extern Node *parser_typecast2(Node *expr, Oid exprType, Type tp, int typlen);
-extern Aggreg *ParseAgg(char *aggname, Oid basetype, Node *target);
-extern void
-handleTargetColname(ParseState *pstate, char **resname,
+
+extern void handleTargetColname(ParseState *pstate, char **resname,
 					char *refname, char *colname);
 
 /*
diff --git a/src/include/parser/sysfunc.h b/src/include/parser/sysfunc.h
index 6ba643c005cb1d087b841eed9545b62a92924bc6..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
--- a/src/include/parser/sysfunc.h
+++ b/src/include/parser/sysfunc.h
@@ -1,9 +0,0 @@
-/*-------------------------------------------------------------------------
- *
- * sysfunc.h--
- *	  support for system functions
- *
- * -------------------------------------------------------------------------
- */
-
-extern char *SystemFunctionHandler(char *funct);
diff --git a/src/include/utils/tqual.h b/src/include/utils/tqual.h
index e07750bd3d6ab20965201eb09a4793ef4ad64ce4..6ee27af2c279c778f6d12675d7228e75a025dd72 100644
--- a/src/include/utils/tqual.h
+++ b/src/include/utils/tqual.h
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: tqual.h,v 1.10 1997/11/02 15:27:14 vadim Exp $
+ * $Id: tqual.h,v 1.11 1997/11/20 23:24:03 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -15,18 +15,12 @@
 
 #include <access/htup.h>
 
-typedef Pointer TimeQual;
-
-/* Tuples valid as of StartTransactionCommand */
-#define NowTimeQual		((TimeQual) NULL)
-
 /* As above, plus updates in this command */
-extern TimeQual SelfTimeQual;
 
 extern void setheapoverride(bool on);
 extern bool heapisoverride(void);
 
-extern bool HeapTupleSatisfiesTimeQual(HeapTuple tuple, TimeQual qual);
+extern bool HeapTupleSatisfiesVisibility(HeapTuple tuple, bool seeself);
 
 
 #endif							/* TQUAL_H */