summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-06-17 23:41:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-06-17 23:41:51 +0000
commitedf0b5f0db0da14340fa4ea140f5c20003e84fe5 (patch)
tree82ef18a42cf3ab710244879d219c993708540487 /src/backend/commands
parentd03a933ec5400f77fc132d4a47bb7d2981ff5187 (diff)
downloadpostgresql-edf0b5f0db0da14340fa4ea140f5c20003e84fe5.tar.gz
Get rid of IndexIsUniqueNoCache() kluge by the simple expedient of
passing the index-is-unique flag to index build routines (duh! ... why wasn't it done this way to begin with?). Aside from eliminating an eyesore, this should save a few milliseconds in btree index creation because a full scan of pg_index is not needed any more.
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/cluster.c3
-rw-r--r--src/backend/commands/indexcmds.c14
2 files changed, 8 insertions, 9 deletions
diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c
index 88e0fa3568..0fff922545 100644
--- a/src/backend/commands/cluster.c
+++ b/src/backend/commands/cluster.c
@@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.55 2000/06/15 03:32:07 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.56 2000/06/17 23:41:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -273,7 +273,6 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
natts,
Old_pg_index_Form->indkey,
Old_pg_index_Form->indclass,
- (uint16) 0, (Datum *) NULL,
(Node *) NULL, /* XXX where's the predicate? */
Old_pg_index_Form->indislossy,
Old_pg_index_Form->indisunique,
diff --git a/src/backend/commands/indexcmds.c b/src/backend/commands/indexcmds.c
index f0d61aa112..e5896b304c 100644
--- a/src/backend/commands/indexcmds.c
+++ b/src/backend/commands/indexcmds.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.30 2000/06/17 21:48:42 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/indexcmds.c,v 1.31 2000/06/17 23:41:36 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -90,11 +90,9 @@ DefineIndex(char *heapRelationName,
int numberOfAttributes;
AttrNumber *attributeNumberA;
HeapTuple tuple;
- uint16 parameterCount = 0;
- Datum *parameterA = NULL;
FuncIndexInfo fInfo;
List *cnfPred = NULL;
- bool lossy = FALSE;
+ bool lossy = false;
List *pl;
/*
@@ -198,7 +196,7 @@ DefineIndex(char *heapRelationName,
index_create(heapRelationName, indexRelationName,
&fInfo, NULL,
accessMethodId, numberOfAttributes, attributeNumberA,
- classObjectId, parameterCount, parameterA,
+ classObjectId,
(Node *) cnfPred,
lossy, unique, primary);
}
@@ -216,7 +214,7 @@ DefineIndex(char *heapRelationName,
index_create(heapRelationName, indexRelationName,
NULL, attributeList,
accessMethodId, numberOfAttributes, attributeNumberA,
- classObjectId, parameterCount, parameterA,
+ classObjectId,
(Node *) cnfPred,
lossy, unique, primary);
}
@@ -252,6 +250,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
HeapTuple tuple;
FuncIndexInfo fInfo;
FuncIndexInfo *funcInfo = NULL;
+ bool unique;
Form_pg_index index;
Node *oldPred = NULL;
List *cnfPred = NULL;
@@ -293,6 +292,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
Assert(index->indexrelid == indexId);
relationId = index->indrelid;
indproc = index->indproc;
+ unique = index->indisunique;
for (i = 0; i < INDEX_MAX_KEYS; i++)
{
@@ -366,7 +366,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
InitIndexStrategy(numberOfAttributes, indexRelation, accessMethodId);
index_build(heapRelation, indexRelation, numberOfAttributes,
- attributeNumberA, 0, NULL, funcInfo, predInfo);
+ attributeNumberA, funcInfo, predInfo, unique);
/* heap and index rels are closed as a side-effect of index_build */
}