Index: src/backend/access/gist/gist.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/gist/gist.c,v
retrieving revision 1.79
diff -u -r1.79 gist.c
--- src/backend/access/gist/gist.c	2001/06/11 05:00:56	1.79
+++ src/backend/access/gist/gist.c	2001/07/13 13:19:58
@@ -116,7 +116,6 @@
 	Relation	heap = (Relation) PG_GETARG_POINTER(0);
 	Relation	index = (Relation) PG_GETARG_POINTER(1);
 	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
 
 #ifdef NOT_USED
 	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
@@ -153,16 +152,13 @@
 	 * We expect to be called exactly once for any index relation. If
 	 * that's not the case, big trouble's what we have.
 	 */
-	if (oldPred == NULL && RelationGetNumberOfBlocks(index) != 0)
+	if (RelationGetNumberOfBlocks(index) != 0)
 		elog(ERROR, "%s already contains data", RelationGetRelationName(index));
 
 	/* initialize the root page (if this is a new index) */
-	if (oldPred == NULL)
-	{
-		buffer = ReadBuffer(index, P_NEW);
-		GISTInitBuffer(buffer, F_LEAF);
-		WriteBuffer(buffer);
-	}
+	buffer = ReadBuffer(index, P_NEW);
+	GISTInitBuffer(buffer, F_LEAF);
+        WriteBuffer(buffer);
 
 	/* get tuple descriptors for heap and index relations */
 	htupdesc = RelationGetDescr(heap);
@@ -179,7 +175,7 @@
 	 * temporary memory context for function evaluation -- tgl July 00
 	 */
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 	{
 		tupleTable = ExecCreateTupleTable(1);
 		slot = ExecAllocTableSlot(tupleTable);
@@ -212,20 +208,6 @@
 #ifndef OMIT_PARTIAL_INDEX
 
 		/*
-		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
-		 * this tuple if it was already in the existing partial index
-		 */
-		if (oldPred != NULL)
-		{
-			slot->val = htup;
-			if (ExecQual((List *) oldPred, econtext, false))
-			{
-				nitups += 1.0;
-				continue;
-			}
-		}
-
-		/*
 		 * Skip this tuple if it doesn't satisfy the partial-index
 		 * predicate
 		 */
@@ -290,7 +272,7 @@
 	pfree(compvec);
 
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 		ExecDropTupleTable(tupleTable, true);
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
@@ -315,12 +297,6 @@
 		index_close(index);
 		UpdateStats(hrelid, nhtups);
 		UpdateStats(irelid, nitups);
-		if (oldPred != NULL)
-		{
-			if (nitups == nhtups)
-				pred = NULL;
-			UpdateIndexPredicate(irelid, oldPred, pred);
-		}
 	}
 
 #ifdef GISTDEBUG
Index: src/backend/access/hash/hash.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/hash/hash.c,v
retrieving revision 1.51
diff -u -r1.51 hash.c
--- src/backend/access/hash/hash.c	2001/05/07 00:43:15	1.51
+++ src/backend/access/hash/hash.c	2001/07/13 13:19:59
@@ -44,7 +44,6 @@
 	Relation	heap = (Relation) PG_GETARG_POINTER(0);
 	Relation	index = (Relation) PG_GETARG_POINTER(1);
 	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
 
 #ifdef NOT_USED
 	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
@@ -74,8 +73,7 @@
 	BuildingHash = true;
 
 	/* initialize the hash index metadata page (if this is a new index) */
-	if (oldPred == NULL)
-		_hash_metapinit(index);
+	_hash_metapinit(index);
 
 	/* get tuple descriptors for heap and index relations */
 	htupdesc = RelationGetDescr(heap);
@@ -92,7 +90,7 @@
 	 * temporary memory context for function evaluation -- tgl July 00
 	 */
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 	{
 		tupleTable = ExecCreateTupleTable(1);
 		slot = ExecAllocTableSlot(tupleTable);
@@ -123,20 +121,6 @@
 #ifndef OMIT_PARTIAL_INDEX
 
 		/*
-		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
-		 * this tuple if it was already in the existing partial index
-		 */
-		if (oldPred != NULL)
-		{
-			slot->val = htup;
-			if (ExecQual((List *) oldPred, econtext, false))
-			{
-				nitups += 1.0;
-				continue;
-			}
-		}
-
-		/*
 		 * Skip this tuple if it doesn't satisfy the partial-index
 		 * predicate
 		 */
@@ -195,7 +179,7 @@
 	heap_endscan(hscan);
 
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 		ExecDropTupleTable(tupleTable, true);
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
@@ -220,12 +204,6 @@
 		index_close(index);
 		UpdateStats(hrelid, nhtups);
 		UpdateStats(irelid, nitups);
-		if (oldPred != NULL)
-		{
-			if (nitups == nhtups)
-				pred = NULL;
-			UpdateIndexPredicate(irelid, oldPred, pred);
-		}
 	}
 
 	/* all done */
Index: src/backend/access/nbtree/nbtree.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v
retrieving revision 1.81
diff -u -r1.81 nbtree.c
--- src/backend/access/nbtree/nbtree.c	2001/05/18 21:24:17	1.81
+++ src/backend/access/nbtree/nbtree.c	2001/07/13 13:19:59
@@ -56,7 +56,7 @@
 	Relation	heap = (Relation) PG_GETARG_POINTER(0);
 	Relation	index = (Relation) PG_GETARG_POINTER(1);
 	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
+
 #ifdef NOT_USED
 	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
 #endif
@@ -108,8 +108,7 @@
 #endif	 /* BTREE_BUILD_STATS */
 
 	/* initialize the btree index metadata page (if this is a new index) */
-	if (oldPred == NULL)
-		_bt_metapinit(index);
+	_bt_metapinit(index);
 
 	/* get tuple descriptors for heap and index relations */
 	htupdesc = RelationGetDescr(heap);
@@ -126,7 +125,7 @@
 	 * temporary memory context for function evaluation -- tgl July 00
 	 */
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 	{
 		tupleTable = ExecCreateTupleTable(1);
 		slot = ExecAllocTableSlot(tupleTable);
@@ -197,20 +196,6 @@
 #ifndef OMIT_PARTIAL_INDEX
 
 		/*
-		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
-		 * this tuple if it was already in the existing partial index
-		 */
-		if (oldPred != NULL)
-		{
-			slot->val = htup;
-			if (ExecQual((List *) oldPred, econtext, false))
-			{
-				nitups += 1.0;
-				continue;
-			}
-		}
-
-		/*
 		 * Skip this tuple if it doesn't satisfy the partial-index
 		 * predicate
 		 */
@@ -298,7 +283,7 @@
 	}
 
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 		ExecDropTupleTable(tupleTable, true);
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
@@ -345,12 +330,6 @@
 		index_close(index);
 		UpdateStats(hrelid, nhtups);
 		UpdateStats(irelid, nitups);
-		if (oldPred != NULL)
-		{
-			if (nitups == nhtups)
-				pred = NULL;
-			UpdateIndexPredicate(irelid, oldPred, pred);
-		}
 	}
 
 	/* all done */
Index: src/backend/access/rtree/rtree.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/rtree/rtree.c,v
retrieving revision 1.62
diff -u -r1.62 rtree.c
--- src/backend/access/rtree/rtree.c	2001/05/07 00:43:16	1.62
+++ src/backend/access/rtree/rtree.c	2001/07/13 13:20:00
@@ -87,7 +87,6 @@
 	Relation	heap = (Relation) PG_GETARG_POINTER(0);
 	Relation	index = (Relation) PG_GETARG_POINTER(1);
 	IndexInfo  *indexInfo = (IndexInfo *) PG_GETARG_POINTER(2);
-	Node	   *oldPred = (Node *) PG_GETARG_POINTER(3);
 
 #ifdef NOT_USED
 	IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
@@ -120,16 +119,13 @@
 	 * We expect to be called exactly once for any index relation. If
 	 * that's not the case, big trouble's what we have.
 	 */
-	if (oldPred == NULL && RelationGetNumberOfBlocks(index) != 0)
+	if (RelationGetNumberOfBlocks(index) != 0)
 		elog(ERROR, "%s already contains data", RelationGetRelationName(index));
 
 	/* initialize the root page (if this is a new index) */
-	if (oldPred == NULL)
-	{
-		buffer = ReadBuffer(index, P_NEW);
-		RTInitBuffer(buffer, F_LEAF);
-		WriteBuffer(buffer);
-	}
+	buffer = ReadBuffer(index, P_NEW);
+	RTInitBuffer(buffer, F_LEAF);
+	WriteBuffer(buffer);
 
 	/* get tuple descriptors for heap and index relations */
 	htupdesc = RelationGetDescr(heap);
@@ -146,7 +142,7 @@
 	 * temporary memory context for function evaluation -- tgl July 00
 	 */
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 	{
 		tupleTable = ExecCreateTupleTable(1);
 		slot = ExecAllocTableSlot(tupleTable);
@@ -177,20 +173,6 @@
 #ifndef OMIT_PARTIAL_INDEX
 
 		/*
-		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
-		 * this tuple if it was already in the existing partial index
-		 */
-		if (oldPred != NULL)
-		{
-			slot->val = htup;
-			if (ExecQual((List *) oldPred, econtext, false))
-			{
-				nitups += 1.0;
-				continue;
-			}
-		}
-
-		/*
 		 * Skip this tuple if it doesn't satisfy the partial-index
 		 * predicate
 		 */
@@ -236,7 +218,7 @@
 	heap_endscan(hscan);
 
 #ifndef OMIT_PARTIAL_INDEX
-	if (pred != NULL || oldPred != NULL)
+	if (pred != NULL)
 		ExecDropTupleTable(tupleTable, true);
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
@@ -261,12 +243,6 @@
 		index_close(index);
 		UpdateStats(hrelid, nhtups);
 		UpdateStats(irelid, nitups);
-		if (oldPred != NULL)
-		{
-			if (nitups == nhtups)
-				pred = NULL;
-			UpdateIndexPredicate(irelid, oldPred, pred);
-		}
 	}
 
 	PG_RETURN_VOID();
Index: src/backend/bootstrap/bootstrap.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v
retrieving revision 1.110
diff -u -r1.110 bootstrap.c
--- src/backend/bootstrap/bootstrap.c	2001/06/25 23:03:03	1.110
+++ src/backend/bootstrap/bootstrap.c	2001/07/13 13:20:00
@@ -1119,7 +1119,7 @@
 
 		heap = heap_openr(ILHead->il_heap, NoLock);
 		ind = index_openr(ILHead->il_ind);
-		index_build(heap, ind, ILHead->il_info, NULL);
+		index_build(heap, ind, ILHead->il_info);
 
 		/*
 		 * In normal processing mode, index_build would close the heap and
Index: src/backend/catalog/heap.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/heap.c,v
retrieving revision 1.170
diff -u -r1.170 heap.c
--- src/backend/catalog/heap.c	2001/06/29 21:08:24	1.170
+++ src/backend/catalog/heap.c	2001/07/13 13:20:01
@@ -1031,7 +1031,7 @@
 		/* Initialize the index and rebuild */
 		InitIndexStrategy(indexInfo->ii_NumIndexAttrs,
 						  currentIndex, accessMethodId);
-		index_build(heapRelation, currentIndex, indexInfo, NULL);
+		index_build(heapRelation, currentIndex, indexInfo);
 
 		/*
 		 * index_build will close both the heap and index relations (but
Index: src/backend/catalog/index.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/catalog/index.c,v
retrieving revision 1.155
diff -u -r1.155 index.c
--- src/backend/catalog/index.c	2001/06/27 23:31:38	1.155
+++ src/backend/catalog/index.c	2001/07/13 13:20:02
@@ -74,8 +74,7 @@
 					Oid *classOids,
 					bool islossy, bool primary);
 static void DefaultBuild(Relation heapRelation, Relation indexRelation,
-			 IndexInfo *indexInfo, Node *oldPred,
-			 IndexStrategy indexStrategy);
+			 IndexInfo *indexInfo, IndexStrategy indexStrategy);
 static Oid	IndexGetRelation(Oid indexId);
 static bool activate_index(Oid indexId, bool activate, bool inplace);
 
@@ -589,87 +588,6 @@
 }
 
 /* ----------------------------------------------------------------
- *		UpdateIndexPredicate
- * ----------------------------------------------------------------
- */
-void
-UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate)
-{
-	Node	   *newPred;
-	char	   *predString;
-	text	   *predText;
-	Relation	pg_index;
-	HeapTuple	tuple;
-	HeapTuple	newtup;
-	int			i;
-	Datum		values[Natts_pg_index];
-	char		nulls[Natts_pg_index];
-	char		replace[Natts_pg_index];
-
-	/*
-	 * Construct newPred as a CNF expression equivalent to the OR of the
-	 * original partial-index predicate ("oldPred") and the extension
-	 * predicate ("predicate").
-	 *
-	 * This should really try to process the result to change things like
-	 * "a>2 OR a>1" to simply "a>1", but for now all it does is make sure
-	 * that if the extension predicate is NULL (i.e., it is being extended
-	 * to be a complete index), then newPred will be NULL - in effect,
-	 * changing "a>2 OR TRUE" to "TRUE". --Nels, Jan '93
-	 */
-	newPred = NULL;
-	if (predicate != NULL)
-	{
-		newPred = (Node *) make_orclause(lcons(make_andclause((List *) predicate),
-								  lcons(make_andclause((List *) oldPred),
-										NIL)));
-		newPred = (Node *) cnfify((Expr *) newPred, true);
-	}
-
-	/* translate the index-predicate to string form */
-	if (newPred != NULL)
-	{
-		predString = nodeToString(newPred);
-		predText = DatumGetTextP(DirectFunctionCall1(textin,
-										   CStringGetDatum(predString)));
-		pfree(predString);
-	}
-	else
-		predText = DatumGetTextP(DirectFunctionCall1(textin,
-												   CStringGetDatum("")));
-
-	/* open the index system catalog relation */
-	pg_index = heap_openr(IndexRelationName, RowExclusiveLock);
-
-	tuple = SearchSysCache(INDEXRELID,
-						   ObjectIdGetDatum(indexoid),
-						   0, 0, 0);
-	if (!HeapTupleIsValid(tuple))
-		elog(ERROR, "UpdateIndexPredicate: cache lookup failed for index %u",
-			 indexoid);
-
-	for (i = 0; i < Natts_pg_index; i++)
-	{
-		nulls[i] = heap_attisnull(tuple, i + 1) ? 'n' : ' ';
-		replace[i] = ' ';
-		values[i] = (Datum) NULL;
-	}
-
-	replace[Anum_pg_index_indpred - 1] = 'r';
-	values[Anum_pg_index_indpred - 1] = (Datum) predText;
-
-	newtup = heap_modifytuple(tuple, pg_index, values, nulls, replace);
-
-	simple_heap_update(pg_index, &newtup->t_self, newtup);
-
-	heap_freetuple(newtup);
-	ReleaseSysCache(tuple);
-
-	heap_close(pg_index, RowExclusiveLock);
-	pfree(predText);
-}
-
-/* ----------------------------------------------------------------
  *		InitIndexStrategy
  *
  * XXX this is essentially the same as relcache.c's
@@ -885,7 +803,7 @@
 		/* XXX shouldn't we close the heap and index rels here? */
 	}
 	else
-		index_build(heapRelation, indexRelation, indexInfo, NULL);
+		index_build(heapRelation, indexRelation, indexInfo);
 }
 
 /* ----------------------------------------------------------------
@@ -1638,7 +1556,6 @@
 DefaultBuild(Relation heapRelation,
 			 Relation indexRelation,
 			 IndexInfo *indexInfo,
-			 Node *oldPred,
 			 IndexStrategy indexStrategy)		/* not used */
 {
 	HeapScanDesc scan;
@@ -1676,7 +1593,7 @@
 	 * temporary memory context for function evaluation -- tgl July 00
 	 */
 #ifndef OMIT_PARTIAL_INDEX
-	if (predicate != NULL || oldPred != NULL)
+	if (predicate != NULL)
 	{
 		tupleTable = ExecCreateTupleTable(1);
 		slot = ExecAllocTableSlot(tupleTable);
@@ -1718,20 +1635,6 @@
 #ifndef OMIT_PARTIAL_INDEX
 
 		/*
-		 * If oldPred != NULL, this is an EXTEND INDEX command, so skip
-		 * this tuple if it was already in the existing partial index
-		 */
-		if (oldPred != NULL)
-		{
-			slot->val = heapTuple;
-			if (ExecQual((List *) oldPred, econtext, false))
-			{
-				indtuples += 1.0;
-				continue;
-			}
-		}
-
-		/*
 		 * Skip this tuple if it doesn't satisfy the partial-index
 		 * predicate
 		 */
@@ -1766,7 +1669,7 @@
 	heap_endscan(scan);
 
 #ifndef OMIT_PARTIAL_INDEX
-	if (predicate != NULL || oldPred != NULL)
+	if (predicate != NULL)
 		ExecDropTupleTable(tupleTable, true);
 #endif	 /* OMIT_PARTIAL_INDEX */
 	FreeExprContext(econtext);
@@ -1791,12 +1694,6 @@
 		index_close(indexRelation);
 		UpdateStats(hrelid, reltuples);
 		UpdateStats(irelid, indtuples);
-		if (oldPred != NULL)
-		{
-			if (indtuples == reltuples)
-				predicate = NULL;
-			UpdateIndexPredicate(irelid, oldPred, predicate);
-		}
 	}
 }
 
@@ -1807,8 +1704,7 @@
 void
 index_build(Relation heapRelation,
 			Relation indexRelation,
-			IndexInfo *indexInfo,
-			Node *oldPred)
+			IndexInfo *indexInfo)
 {
 	RegProcedure procedure;
 
@@ -1824,17 +1720,15 @@
 	 * use the access method build procedure if supplied, else default.
 	 */
 	if (RegProcedureIsValid(procedure))
-		OidFunctionCall5(procedure,
+		OidFunctionCall4(procedure,
 						 PointerGetDatum(heapRelation),
 						 PointerGetDatum(indexRelation),
 						 PointerGetDatum(indexInfo),
-						 PointerGetDatum(oldPred),
 			   PointerGetDatum(RelationGetIndexStrategy(indexRelation)));
 	else
 		DefaultBuild(heapRelation,
 					 indexRelation,
 					 indexInfo,
-					 oldPred,
 					 RelationGetIndexStrategy(indexRelation));
 }
 
@@ -1967,7 +1861,7 @@
 
 	/* Initialize the index and rebuild */
 	InitIndexStrategy(indexInfo->ii_NumIndexAttrs, iRel, accessMethodId);
-	index_build(heapRelation, iRel, indexInfo, NULL);
+	index_build(heapRelation, iRel, indexInfo);
 
 	/*
 	 * index_build will close both the heap and index relations (but not
Index: src/backend/commands/indexcmds.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/commands/indexcmds.c,v
retrieving revision 1.50
diff -u -r1.50 indexcmds.c
--- src/backend/commands/indexcmds.c	2001/06/13 21:44:40	1.50
+++ src/backend/commands/indexcmds.c	2001/07/13 13:20:02
@@ -1,7 +1,7 @@
 /*-------------------------------------------------------------------------
  *
  * indexcmds.c
- *	  POSTGRES define, extend and remove index code.
+ *	  POSTGRES define and remove index code.
  *
  * Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
@@ -215,92 +215,6 @@
 	 * cached lists of the indexes for this relation.
 	 */
 	setRelhasindex(relationId, true);
-}
-
-
-/*
- * ExtendIndex
- *		Extends a partial index.
- */
-void
-ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
-{
-	Relation	heapRelation;
-	Relation	indexRelation;
-	Oid			accessMethodId,
-				indexId,
-				relationId;
-	HeapTuple	tuple;
-	Form_pg_index index;
-	List	   *cnfPred = NIL;
-	IndexInfo  *indexInfo;
-	Node	   *oldPred;
-
-	/*
-	 * Get index's relation id and access method id from pg_class
-	 */
-	tuple = SearchSysCache(RELNAME,
-						   PointerGetDatum(indexRelationName),
-						   0, 0, 0);
-	if (!HeapTupleIsValid(tuple))
-		elog(ERROR, "ExtendIndex: index \"%s\" not found",
-			 indexRelationName);
-	indexId = tuple->t_data->t_oid;
-	accessMethodId = ((Form_pg_class) GETSTRUCT(tuple))->relam;
-	ReleaseSysCache(tuple);
-
-	/*
-	 * Extract info from the pg_index tuple for the index
-	 */
-	tuple = SearchSysCache(INDEXRELID,
-						   ObjectIdGetDatum(indexId),
-						   0, 0, 0);
-	if (!HeapTupleIsValid(tuple))
-		elog(ERROR, "ExtendIndex: relation \"%s\" is not an index",
-			 indexRelationName);
-	index = (Form_pg_index) GETSTRUCT(tuple);
-	Assert(index->indexrelid == indexId);
-	relationId = index->indrelid;
-	indexInfo = BuildIndexInfo(tuple);
-	oldPred = indexInfo->ii_Predicate;
-	ReleaseSysCache(tuple);
-
-	if (oldPred == NULL)
-		elog(ERROR, "ExtendIndex: \"%s\" is not a partial index",
-			 indexRelationName);
-
-	/*
-	 * Convert the extension predicate from parsetree form to plan form,
-	 * so it can be readily evaluated during index creation. Note:
-	 * "predicate" comes in two parts (1) the predicate expression itself,
-	 * and (2) a corresponding range table.
-	 *
-	 * XXX I think this code is broken --- index_build expects a single
-	 * expression not a list --- tgl Jul 00
-	 */
-	if (rangetable != NIL)
-	{
-		cnfPred = cnfify((Expr *) copyObject(predicate), true);
-		fix_opids((Node *) cnfPred);
-		CheckPredicate(cnfPred, rangetable, relationId);
-	}
-
-	/* pass new predicate to index_build */
-	indexInfo->ii_Predicate = (Node *) cnfPred;
-
-	/* Open heap and index rels, and get suitable locks */
-	heapRelation = heap_open(relationId, ShareLock);
-	indexRelation = index_open(indexId);
-
-	/* Obtain exclusive lock on it, just to be sure */
-	LockRelation(indexRelation, AccessExclusiveLock);
-
-	InitIndexStrategy(indexInfo->ii_NumIndexAttrs,
-					  indexRelation, accessMethodId);
-
-	index_build(heapRelation, indexRelation, indexInfo, oldPred);
-
-	/* heap and index rels are closed as a side-effect of index_build */
 }
 
 
Index: src/backend/nodes/copyfuncs.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/copyfuncs.c,v
retrieving revision 1.147
diff -u -r1.147 copyfuncs.c
--- src/backend/nodes/copyfuncs.c	2001/07/12 18:02:59	1.147
+++ src/backend/nodes/copyfuncs.c	2001/07/13 13:20:03
@@ -2037,18 +2037,6 @@
 	return newnode;
 }
 
-static ExtendStmt *
-_copyExtendStmt(ExtendStmt *from)
-{
-	ExtendStmt *newnode = makeNode(ExtendStmt);
-
-	newnode->idxname = pstrdup(from->idxname);
-	Node_Copy(from, newnode, whereClause);
-	Node_Copy(from, newnode, rangetable);
-
-	return newnode;
-}
-
 static FetchStmt *
 _copyFetchStmt(FetchStmt *from)
 {
@@ -2795,9 +2783,6 @@
 			break;
 		case T_CommentStmt:
 			retval = _copyCommentStmt(from);
-			break;
-		case T_ExtendStmt:
-			retval = _copyExtendStmt(from);
 			break;
 		case T_FetchStmt:
 			retval = _copyFetchStmt(from);
Index: src/backend/nodes/equalfuncs.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/nodes/equalfuncs.c,v
retrieving revision 1.95
diff -u -r1.95 equalfuncs.c
--- src/backend/nodes/equalfuncs.c	2001/07/12 18:02:59	1.95
+++ src/backend/nodes/equalfuncs.c	2001/07/13 13:20:03
@@ -899,19 +899,6 @@
 }
 
 static bool
-_equalExtendStmt(ExtendStmt *a, ExtendStmt *b)
-{
-	if (!equalstr(a->idxname, b->idxname))
-		return false;
-	if (!equal(a->whereClause, b->whereClause))
-		return false;
-	if (!equal(a->rangetable, b->rangetable))
-		return false;
-
-	return true;
-}
-
-static bool
 _equalFetchStmt(FetchStmt *a, FetchStmt *b)
 {
 	if (a->direction != b->direction)
@@ -1939,9 +1926,6 @@
 			break;
 		case T_CommentStmt:
 			retval = _equalCommentStmt(a, b);
-			break;
-		case T_ExtendStmt:
-			retval = _equalExtendStmt(a, b);
 			break;
 		case T_FetchStmt:
 			retval = _equalFetchStmt(a, b);
Index: src/backend/parser/analyze.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/analyze.c,v
retrieving revision 1.192
diff -u -r1.192 analyze.c
--- src/backend/parser/analyze.c	2001/07/04 17:36:54	1.192
+++ src/backend/parser/analyze.c	2001/07/13 13:20:04
@@ -45,7 +45,6 @@
 static Query *transformDeleteStmt(ParseState *pstate, DeleteStmt *stmt);
 static Query *transformInsertStmt(ParseState *pstate, InsertStmt *stmt);
 static Query *transformIndexStmt(ParseState *pstate, IndexStmt *stmt);
-static Query *transformExtendStmt(ParseState *pstate, ExtendStmt *stmt);
 static Query *transformRuleStmt(ParseState *query, RuleStmt *stmt);
 static Query *transformSelectStmt(ParseState *pstate, SelectStmt *stmt);
 static Query *transformSetOperationStmt(ParseState *pstate, SelectStmt *stmt);
@@ -148,10 +147,6 @@
 			result = transformIndexStmt(pstate, (IndexStmt *) parseTree);
 			break;
 
-		case T_ExtendStmt:
-			result = transformExtendStmt(pstate, (ExtendStmt *) parseTree);
-			break;
-
 		case T_RuleStmt:
 			result = transformRuleStmt(pstate, (RuleStmt *) parseTree);
 			break;
@@ -1643,30 +1638,6 @@
 
 	qry->utilityStmt = (Node *) stmt;
 
-	return qry;
-}
-
-/*
- * transformExtendStmt -
- *	  transform the qualifications of the Extend Index Statement
- *
- */
-static Query *
-transformExtendStmt(ParseState *pstate, ExtendStmt *stmt)
-{
-	Query	   *qry;
-
-	qry = makeNode(Query);
-	qry->commandType = CMD_UTILITY;
-
-	/* take care of the where clause */
-	stmt->whereClause = transformWhereClause(pstate, stmt->whereClause);
-
-	qry->hasSubLinks = pstate->p_hasSubLinks;
-
-	stmt->rangetable = pstate->p_rtable;
-
-	qry->utilityStmt = (Node *) stmt;
 	return qry;
 }
 
Index: src/backend/parser/gram.y
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/gram.y,v
retrieving revision 2.236
diff -u -r2.236 gram.y
--- src/backend/parser/gram.y	2001/07/12 18:02:59	2.236
+++ src/backend/parser/gram.y	2001/07/13 13:20:06
@@ -135,7 +135,7 @@
 		CreateSchemaStmt, CreateSeqStmt, CreateStmt, CreateTrigStmt,
 		CreateUserStmt, CreatedbStmt, CursorStmt, DefineStmt, DeleteStmt,
 		DropGroupStmt, DropPLangStmt, DropSchemaStmt, DropStmt, DropTrigStmt,
-		DropUserStmt, DropdbStmt, ExplainStmt, ExtendStmt, FetchStmt,
+		DropUserStmt, DropdbStmt, ExplainStmt, FetchStmt,
 		GrantStmt, IndexStmt, InsertStmt, ListenStmt, LoadStmt, LockStmt,
 		NotifyStmt, OptimizableStmt, ProcedureStmt, ReindexStmt,
 		RemoveAggrStmt, RemoveFuncStmt, RemoveOperStmt,
@@ -345,7 +345,7 @@
 		BACKWARD, BEFORE, BINARY, BIT,
 		CACHE, CHECKPOINT, CLUSTER, COMMENT, COPY, CREATEDB, CREATEUSER, CYCLE,
 		DATABASE, DELIMITERS, DO,
-		EACH, ENCODING, EXCLUSIVE, EXPLAIN, EXTEND,
+		EACH, ENCODING, EXCLUSIVE, EXPLAIN, 
 		FORCE, FORWARD, FUNCTION, HANDLER,
 		ILIKE, INCREMENT, INDEX, INHERITS, INSTEAD, ISNULL,
 		LANCOMPILER, LIMIT, LISTEN, LOAD, LOCATION, LOCK_P,
@@ -450,7 +450,6 @@
 		| DropPLangStmt
 		| DropTrigStmt
 		| DropUserStmt
-		| ExtendStmt
 		| ExplainStmt
 		| FetchStmt
 		| GrantStmt
@@ -2470,23 +2469,6 @@
 		| /*EMPTY*/								{ $$ = NULL; }
 		;
 
-
-/*****************************************************************************
- *
- *		QUERY:
- *				extend index <indexname> [where <qual>]
- *
- *****************************************************************************/
-
-ExtendStmt:  EXTEND INDEX index_name where_clause
-				{
-					ExtendStmt *n = makeNode(ExtendStmt);
-					n->idxname = $3;
-					n->whereClause = $4;
-					$$ = (Node *)n;
-				}
-		;
-
 /*****************************************************************************
  *
  *		QUERY:
@@ -5775,7 +5757,6 @@
 		| EXCEPT						{ $$ = "except"; }
 		| EXISTS						{ $$ = "exists"; }
 		| EXPLAIN						{ $$ = "explain"; }
-		| EXTEND						{ $$ = "extend"; }
 		| EXTRACT						{ $$ = "extract"; }
 		| FALSE_P						{ $$ = "false"; }
 		| FLOAT							{ $$ = "float"; }
Index: src/backend/parser/keywords.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/parser/keywords.c,v
retrieving revision 1.93
diff -u -r1.93 keywords.c
--- src/backend/parser/keywords.c	2001/06/19 22:39:11	1.93
+++ src/backend/parser/keywords.c	2001/07/13 13:20:07
@@ -109,7 +109,6 @@
 	{"execute", EXECUTE},
 	{"exists", EXISTS},
 	{"explain", EXPLAIN},
-	{"extend", EXTEND},
 	{"extract", EXTRACT},
 	{"false", FALSE_P},
 	{"fetch", FETCH},
Index: src/backend/tcop/utility.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/backend/tcop/utility.c,v
retrieving revision 1.114
diff -u -r1.114 utility.c
--- src/backend/tcop/utility.c	2001/06/18 16:13:21	1.114
+++ src/backend/tcop/utility.c	2001/07/13 13:20:07
@@ -567,18 +567,6 @@
 			DefineSequence((CreateSeqStmt *) parsetree);
 			break;
 
-		case T_ExtendStmt:
-			{
-				ExtendStmt *stmt = (ExtendStmt *) parsetree;
-
-				set_ps_display(commandTag = "EXTEND");
-
-				ExtendIndex(stmt->idxname,		/* index name */
-							(Expr *) stmt->whereClause, /* where */
-							stmt->rangetable);
-			}
-			break;
-
 		case T_RemoveAggrStmt:
 			{
 				RemoveAggrStmt *stmt = (RemoveAggrStmt *) parsetree;
Index: src/include/catalog/index.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/catalog/index.h,v
retrieving revision 1.35
diff -u -r1.35 index.h
--- src/include/catalog/index.h	2001/05/30 20:52:34	1.35
+++ src/include/catalog/index.h	2001/07/13 13:20:08
@@ -20,8 +20,6 @@
 extern Form_pg_am AccessMethodObjectIdGetForm(Oid accessMethodObjectId,
 							MemoryContext resultCxt);
 
-extern void UpdateIndexPredicate(Oid indexoid, Node *oldPred, Node *predicate);
-
 extern void InitIndexStrategy(int numatts,
 				  Relation indexRelation,
 				  Oid accessMethodObjectId);
@@ -56,7 +54,7 @@
 extern bool IsReindexProcessing(void);
 
 extern void index_build(Relation heapRelation, Relation indexRelation,
-			IndexInfo *indexInfo, Node *oldPred);
+			IndexInfo *indexInfo);
 
 extern bool reindex_index(Oid indexId, bool force, bool inplace);
 extern bool activate_indexes_of_a_table(Oid relid, bool activate);
Index: src/include/commands/defrem.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/commands/defrem.h,v
retrieving revision 1.22
diff -u -r1.22 defrem.h
--- src/include/commands/defrem.h	2001/01/24 19:43:23	1.22
+++ src/include/commands/defrem.h	2001/07/13 13:20:08
@@ -29,9 +29,6 @@
 			bool primary,
 			Expr *predicate,
 			List *rangetable);
-extern void ExtendIndex(char *indexRelationName,
-			Expr *predicate,
-			List *rangetable);
 extern void RemoveIndex(char *name);
 extern void ReindexIndex(const char *indexRelationName, bool force);
 extern void ReindexTable(const char *relationName, bool force);
Index: src/include/nodes/nodes.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/nodes/nodes.h,v
retrieving revision 1.91
diff -u -r1.91 nodes.h
--- src/include/nodes/nodes.h	2001/06/19 22:39:12	1.91
+++ src/include/nodes/nodes.h	2001/07/13 13:20:08
@@ -158,7 +158,6 @@
 	T_DropStmt,
 	T_TruncateStmt,
 	T_CommentStmt,
-	T_ExtendStmt,
 	T_FetchStmt,
 	T_IndexStmt,
 	T_ProcedureStmt,
Index: src/include/nodes/parsenodes.h
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/include/nodes/parsenodes.h,v
retrieving revision 1.135
diff -u -r1.135 parsenodes.h
--- src/include/nodes/parsenodes.h	2001/07/12 18:03:00	1.135
+++ src/include/nodes/parsenodes.h	2001/07/13 13:20:08
@@ -466,19 +466,6 @@
 } CommentStmt;
 
 /* ----------------------
- *		Extend Index Statement
- * ----------------------
- */
-typedef struct ExtendStmt
-{
-	NodeTag		type;
-	char	   *idxname;		/* name of the index */
-	Node	   *whereClause;	/* qualifications */
-	List	   *rangetable;		/* range table, filled in by
-								 * transformStmt() */
-} ExtendStmt;
-
-/* ----------------------
  *		Begin Recipe Statement
  * ----------------------
  */
Index: src/interfaces/ecpg/preproc/keywords.c
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/ecpg/preproc/keywords.c,v
retrieving revision 1.41
diff -u -r1.41 keywords.c
--- src/interfaces/ecpg/preproc/keywords.c	2001/06/01 06:23:19	1.41
+++ src/interfaces/ecpg/preproc/keywords.c	2001/07/13 13:20:08
@@ -109,7 +109,6 @@
 	{"execute", EXECUTE},
 	{"exists", EXISTS},
 	{"explain", EXPLAIN},
-	{"extend", EXTEND},
 	{"extract", EXTRACT},
 	{"false", FALSE_P},
 	{"fetch", FETCH},
Index: src/interfaces/ecpg/preproc/preproc.y
===================================================================
RCS file: /home/projects/pgsql/cvsroot/pgsql/src/interfaces/ecpg/preproc/preproc.y,v
retrieving revision 1.145
diff -u -r1.145 preproc.y
--- src/interfaces/ecpg/preproc/preproc.y	2001/07/12 18:03:00	1.145
+++ src/interfaces/ecpg/preproc/preproc.y	2001/07/13 13:20:11
@@ -217,7 +217,7 @@
 		BACKWARD, BEFORE, BINARY, BIT, CACHE, CHECKPOINT, CLUSTER,
 		COMMENT, COPY, CREATEDB, CREATEUSER, CYCLE, DATABASE,
 		DELIMITERS, DO, EACH, ENCODING, EXCLUSIVE, EXPLAIN,
-		EXTEND, FORCE, FORWARD, FUNCTION, HANDLER, INCREMENT,
+		FORCE, FORWARD, FUNCTION, HANDLER, INCREMENT,
 		INDEX, INHERITS, INSTEAD, ISNULL, LANCOMPILER, LIMIT,
 		LISTEN, UNLISTEN, LOAD, LOCATION, LOCK_P, MAXVALUE,
 		MINVALUE, MODE, MOVE, NEW, NOCREATEDB, NOCREATEUSER,
@@ -312,7 +312,7 @@
 %type  <str>	RuleActionStmtOrEmpty RuleActionMulti func_as reindex_type
 %type  <str>    RuleStmt opt_column opt_name oper_argtypes
 %type  <str>    MathOp RemoveFuncStmt aggr_argtype for_update_clause
-%type  <str>    RemoveAggrStmt ExtendStmt opt_procedural select_no_parens
+%type  <str>    RemoveAggrStmt opt_procedural select_no_parens
 %type  <str>    RemoveOperStmt RenameStmt all_Op
 %type  <str>    VariableSetStmt var_value zone_value VariableShowStmt
 %type  <str>    VariableResetStmt AlterTableStmt DropUserStmt from_list
@@ -414,7 +414,6 @@
 		| DropPLangStmt		{ output_statement($1, 0, NULL, connection); }
 		| DropTrigStmt		{ output_statement($1, 0, NULL, connection); }
 		| DropUserStmt		{ output_statement($1, 0, NULL, connection); }
-		| ExtendStmt 		{ output_statement($1, 0, NULL, connection); }
 		| ExplainStmt		{ output_statement($1, 0, NULL, connection); }
 		| FetchStmt		{ output_statement($1, 1, NULL, connection); }
 		| GrantStmt		{ output_statement($1, 0, NULL, connection); }
@@ -1869,20 +1868,6 @@
 /*****************************************************************************
  *
  *		QUERY:
- *				extend index <indexname> [where <qual>]
- *
- *****************************************************************************/
-
-ExtendStmt:  EXTEND INDEX index_name where_clause
-				{
-					$$ = cat_str(3, make_str("extend index"), $3, $4);
-				}
-		;
-
-
-/*****************************************************************************
- *
- *		QUERY:
  *				execute recipe <recipeName>
  *
  *****************************************************************************/
@@ -5152,7 +5137,6 @@
 		| EXCEPT	{ $$ = make_str("except"); }
 		| EXISTS	{ $$ = make_str("exists"); }
 		| EXPLAIN	{ $$ = make_str("explain"); }
-		| EXTEND	{ $$ = make_str("extend"); }
 		| EXTRACT	{ $$ = make_str("extract"); }
 		| FALSE_P	{ $$ = make_str("false"); }
 		| FOR		{ $$ = make_str("for"); }
