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.
This commit is contained in:
parent
d03a933ec5
commit
edf0b5f0db
@ -6,7 +6,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.58 2000/06/15 03:31:53 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/gist/gist.c,v 1.59 2000/06/17 23:41:12 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -67,13 +67,12 @@ gistbuild(PG_FUNCTION_ARGS)
|
||||
Relation index = (Relation) PG_GETARG_POINTER(1);
|
||||
int32 natts = PG_GETARG_INT32(2);
|
||||
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
|
||||
#ifdef NOT_USED
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
|
||||
uint16 pcount = PG_GETARG_UINT16(5);
|
||||
Datum *params = (Datum *) PG_GETARG_POINTER(6);
|
||||
bool unique = PG_GETARG_BOOL(6);
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
|
||||
#endif
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
|
||||
HeapScanDesc scan;
|
||||
AttrNumber i;
|
||||
HeapTuple htup;
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.39 2000/06/14 05:24:35 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/hash/hash.c,v 1.40 2000/06/17 23:41:13 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* This file contains only the public interface routines.
|
||||
@ -43,13 +43,12 @@ hashbuild(PG_FUNCTION_ARGS)
|
||||
Relation index = (Relation) PG_GETARG_POINTER(1);
|
||||
int32 natts = PG_GETARG_INT32(2);
|
||||
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
|
||||
#ifdef NOT_USED
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
|
||||
uint16 pcount = PG_GETARG_UINT16(5);
|
||||
Datum *params = (Datum *) PG_GETARG_POINTER(6);
|
||||
bool unique = PG_GETARG_BOOL(6);
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
|
||||
#endif
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
|
||||
HeapScanDesc hscan;
|
||||
HeapTuple htup;
|
||||
IndexTuple itup;
|
||||
|
@ -12,7 +12,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.58 2000/06/15 04:09:36 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtree.c,v 1.59 2000/06/17 23:41:16 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -47,13 +47,12 @@ btbuild(PG_FUNCTION_ARGS)
|
||||
Relation index = (Relation) PG_GETARG_POINTER(1);
|
||||
int32 natts = PG_GETARG_INT32(2);
|
||||
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
|
||||
bool unique = PG_GETARG_BOOL(6);
|
||||
#ifdef NOT_USED
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
|
||||
uint16 pcount = PG_GETARG_UINT16(5);
|
||||
Datum *params = (Datum *) PG_GETARG_POINTER(6);
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
|
||||
#endif
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
|
||||
HeapScanDesc hscan;
|
||||
HeapTuple htup;
|
||||
IndexTuple itup;
|
||||
@ -76,7 +75,6 @@ btbuild(PG_FUNCTION_ARGS)
|
||||
Node *pred,
|
||||
*oldPred;
|
||||
BTSpool *spool = NULL;
|
||||
bool isunique;
|
||||
bool usefast;
|
||||
|
||||
/* note that this is a new btree */
|
||||
@ -98,9 +96,6 @@ btbuild(PG_FUNCTION_ARGS)
|
||||
ResetUsage();
|
||||
#endif /* BTREE_BUILD_STATS */
|
||||
|
||||
/* see if index is unique */
|
||||
isunique = IndexIsUniqueNoCache(RelationGetRelid(index));
|
||||
|
||||
/* initialize the btree index metadata page (if this is a new index) */
|
||||
if (oldPred == NULL)
|
||||
_bt_metapinit(index);
|
||||
@ -146,7 +141,7 @@ btbuild(PG_FUNCTION_ARGS)
|
||||
|
||||
if (usefast)
|
||||
{
|
||||
spool = _bt_spoolinit(index, isunique);
|
||||
spool = _bt_spoolinit(index, unique);
|
||||
res = (InsertIndexResult) NULL;
|
||||
}
|
||||
|
||||
@ -254,7 +249,7 @@ btbuild(PG_FUNCTION_ARGS)
|
||||
if (usefast)
|
||||
_bt_spool(btitem, spool);
|
||||
else
|
||||
res = _bt_doinsert(index, btitem, isunique, heap);
|
||||
res = _bt_doinsert(index, btitem, unique, heap);
|
||||
|
||||
pfree(btitem);
|
||||
pfree(itup);
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.49 2000/06/14 05:24:43 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/access/rtree/Attic/rtree.c,v 1.50 2000/06/17 23:41:22 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -66,13 +66,12 @@ rtbuild(PG_FUNCTION_ARGS)
|
||||
Relation index = (Relation) PG_GETARG_POINTER(1);
|
||||
int32 natts = PG_GETARG_INT32(2);
|
||||
AttrNumber *attnum = (AttrNumber *) PG_GETARG_POINTER(3);
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(4);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(5);
|
||||
#ifdef NOT_USED
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(4);
|
||||
uint16 pcount = PG_GETARG_UINT16(5);
|
||||
Datum *params = (Datum *) PG_GETARG_POINTER(6);
|
||||
bool unique = PG_GETARG_BOOL(6);
|
||||
IndexStrategy istrat = (IndexStrategy) PG_GETARG_POINTER(7);
|
||||
#endif
|
||||
FuncIndexInfo *finfo = (FuncIndexInfo *) PG_GETARG_POINTER(7);
|
||||
PredInfo *predInfo = (PredInfo *) PG_GETARG_POINTER(8);
|
||||
HeapScanDesc scan;
|
||||
AttrNumber i;
|
||||
HeapTuple htup;
|
||||
|
@ -8,7 +8,7 @@
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.85 2000/06/05 07:28:40 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/bootstrap/bootstrap.c,v 1.86 2000/06/17 23:41:27 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -161,10 +161,9 @@ typedef struct _IndexList
|
||||
char *il_ind;
|
||||
int il_natts;
|
||||
AttrNumber *il_attnos;
|
||||
uint16 il_nparams;
|
||||
Datum *il_params;
|
||||
FuncIndexInfo *il_finfo;
|
||||
PredInfo *il_predInfo;
|
||||
bool il_unique;
|
||||
struct _IndexList *il_next;
|
||||
} IndexList;
|
||||
|
||||
@ -1071,12 +1070,10 @@ index_register(char *heap,
|
||||
char *ind,
|
||||
int natts,
|
||||
AttrNumber *attnos,
|
||||
uint16 nparams,
|
||||
Datum *params,
|
||||
FuncIndexInfo *finfo,
|
||||
PredInfo *predInfo)
|
||||
PredInfo *predInfo,
|
||||
bool unique)
|
||||
{
|
||||
Datum *v;
|
||||
IndexList *newind;
|
||||
int len;
|
||||
MemoryContext oldcxt;
|
||||
@ -1103,25 +1100,12 @@ index_register(char *heap,
|
||||
len = natts * sizeof(AttrNumber);
|
||||
|
||||
newind->il_attnos = (AttrNumber *) palloc(len);
|
||||
memmove(newind->il_attnos, attnos, len);
|
||||
memcpy(newind->il_attnos, attnos, len);
|
||||
|
||||
if ((newind->il_nparams = nparams) > 0)
|
||||
{
|
||||
v = newind->il_params = (Datum *) palloc(2 * nparams * sizeof(Datum));
|
||||
nparams *= 2;
|
||||
while (nparams-- > 0)
|
||||
{
|
||||
*v = (Datum) palloc(strlen((char *) (*params)) + 1);
|
||||
strcpy((char *) *v++, (char *) *params++);
|
||||
}
|
||||
}
|
||||
else
|
||||
newind->il_params = (Datum *) NULL;
|
||||
|
||||
if (finfo != (FuncIndexInfo *) NULL)
|
||||
if (PointerIsValid(finfo))
|
||||
{
|
||||
newind->il_finfo = (FuncIndexInfo *) palloc(sizeof(FuncIndexInfo));
|
||||
memmove(newind->il_finfo, finfo, sizeof(FuncIndexInfo));
|
||||
memcpy(newind->il_finfo, finfo, sizeof(FuncIndexInfo));
|
||||
}
|
||||
else
|
||||
newind->il_finfo = (FuncIndexInfo *) NULL;
|
||||
@ -1135,6 +1119,8 @@ index_register(char *heap,
|
||||
else
|
||||
newind->il_predInfo = NULL;
|
||||
|
||||
newind->il_unique = unique;
|
||||
|
||||
newind->il_next = ILHead;
|
||||
|
||||
ILHead = newind;
|
||||
@ -1155,8 +1141,8 @@ build_indices()
|
||||
ind = index_openr(ILHead->il_ind);
|
||||
Assert(ind);
|
||||
index_build(heap, ind, ILHead->il_natts, ILHead->il_attnos,
|
||||
ILHead->il_nparams, ILHead->il_params, ILHead->il_finfo,
|
||||
ILHead->il_predInfo);
|
||||
ILHead->il_finfo, ILHead->il_predInfo,
|
||||
ILHead->il_unique);
|
||||
|
||||
/*
|
||||
* In normal processing mode, index_build would close the heap and
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.131 2000/06/15 03:32:01 momjian Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/heap.c,v 1.132 2000/06/17 23:41:31 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -1112,6 +1112,7 @@ RelationTruncateIndexes(Relation heapRelation)
|
||||
AttrNumber *attributeNumberA;
|
||||
FuncIndexInfo fInfo,
|
||||
*funcInfo = NULL;
|
||||
bool unique;
|
||||
int i,
|
||||
numberOfAttributes;
|
||||
char *predString;
|
||||
@ -1134,6 +1135,7 @@ RelationTruncateIndexes(Relation heapRelation)
|
||||
index = (Form_pg_index) GETSTRUCT(indexTuple);
|
||||
indexId = index->indexrelid;
|
||||
procId = index->indproc;
|
||||
unique = index->indisunique;
|
||||
|
||||
for (i = 0; i < INDEX_MAX_KEYS; i++)
|
||||
{
|
||||
@ -1201,7 +1203,7 @@ RelationTruncateIndexes(Relation heapRelation)
|
||||
/* Initialize the index and rebuild */
|
||||
InitIndexStrategy(numberOfAttributes, currentIndex, accessMethodId);
|
||||
index_build(heapRelation, currentIndex, numberOfAttributes,
|
||||
attributeNumberA, 0, NULL, funcInfo, predInfo);
|
||||
attributeNumberA, funcInfo, predInfo, unique);
|
||||
|
||||
/*
|
||||
* index_build will close both the heap and index relations (but
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.117 2000/06/17 21:48:39 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/catalog/index.c,v 1.118 2000/06/17 23:41:34 tgl Exp $
|
||||
*
|
||||
*
|
||||
* INTERFACE ROUTINES
|
||||
@ -72,9 +72,9 @@ static void UpdateIndexRelation(Oid indexoid, Oid heapoid,
|
||||
AttrNumber *attNums, Oid *classOids, Node *predicate,
|
||||
List *attributeList, bool islossy, bool unique, bool primary);
|
||||
static void DefaultBuild(Relation heapRelation, Relation indexRelation,
|
||||
int numberOfAttributes, AttrNumber *attributeNumber,
|
||||
IndexStrategy indexStrategy, uint16 parameterCount,
|
||||
Datum *parameter, FuncIndexInfoPtr funcInfo, PredInfo *predInfo);
|
||||
int numberOfAttributes, AttrNumber *attributeNumber,
|
||||
FuncIndexInfoPtr funcInfo, PredInfo *predInfo,
|
||||
bool unique, IndexStrategy indexStrategy);
|
||||
static Oid IndexGetRelation(Oid indexId);
|
||||
static bool activate_index(Oid indexId, bool activate);
|
||||
|
||||
@ -952,8 +952,6 @@ index_create(char *heapRelationName,
|
||||
int numatts,
|
||||
AttrNumber *attNums,
|
||||
Oid *classObjectId,
|
||||
uint16 parameterCount,
|
||||
Datum *parameter,
|
||||
Node *predicate,
|
||||
bool islossy,
|
||||
bool unique,
|
||||
@ -1086,13 +1084,13 @@ index_create(char *heapRelationName,
|
||||
if (IsBootstrapProcessingMode())
|
||||
{
|
||||
index_register(heapRelationName, indexRelationName, numatts, attNums,
|
||||
parameterCount, parameter, funcInfo, predInfo);
|
||||
funcInfo, predInfo, unique);
|
||||
/* XXX shouldn't we close the heap and index rels here? */
|
||||
}
|
||||
else
|
||||
{
|
||||
index_build(heapRelation, indexRelation, numatts, attNums,
|
||||
parameterCount, parameter, funcInfo, predInfo);
|
||||
funcInfo, predInfo, unique);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1706,6 +1704,11 @@ FillDummyExprContext(ExprContext *econtext,
|
||||
|
||||
/* ----------------
|
||||
* DefaultBuild
|
||||
*
|
||||
* NB: this routine is dead code, and likely always has been, because
|
||||
* there are no access methods that don't supply their own ambuild procedure.
|
||||
*
|
||||
* Anyone want to wager whether it would actually work if executed?
|
||||
* ----------------
|
||||
*/
|
||||
static void
|
||||
@ -1713,11 +1716,10 @@ DefaultBuild(Relation heapRelation,
|
||||
Relation indexRelation,
|
||||
int numberOfAttributes,
|
||||
AttrNumber *attributeNumber,
|
||||
IndexStrategy indexStrategy, /* not used */
|
||||
uint16 parameterCount, /* not used */
|
||||
Datum *parameter, /* not used */
|
||||
FuncIndexInfoPtr funcInfo,
|
||||
PredInfo *predInfo)
|
||||
PredInfo *predInfo,
|
||||
bool unique, /* not used */
|
||||
IndexStrategy indexStrategy) /* not used */
|
||||
{
|
||||
HeapScanDesc scan;
|
||||
HeapTuple heapTuple;
|
||||
@ -1925,10 +1927,9 @@ index_build(Relation heapRelation,
|
||||
Relation indexRelation,
|
||||
int numberOfAttributes,
|
||||
AttrNumber *attributeNumber,
|
||||
uint16 parameterCount,
|
||||
Datum *parameter,
|
||||
FuncIndexInfo *funcInfo,
|
||||
PredInfo *predInfo)
|
||||
PredInfo *predInfo,
|
||||
bool unique)
|
||||
{
|
||||
RegProcedure procedure;
|
||||
|
||||
@ -1942,30 +1943,28 @@ index_build(Relation heapRelation,
|
||||
procedure = indexRelation->rd_am->ambuild;
|
||||
|
||||
/* ----------------
|
||||
* use the access method build procedure if supplied..
|
||||
* use the access method build procedure if supplied, else default.
|
||||
* ----------------
|
||||
*/
|
||||
if (RegProcedureIsValid(procedure))
|
||||
OidFunctionCall9(procedure,
|
||||
OidFunctionCall8(procedure,
|
||||
PointerGetDatum(heapRelation),
|
||||
PointerGetDatum(indexRelation),
|
||||
Int32GetDatum(numberOfAttributes),
|
||||
PointerGetDatum(attributeNumber),
|
||||
PointerGetDatum(RelationGetIndexStrategy(indexRelation)),
|
||||
UInt16GetDatum(parameterCount),
|
||||
PointerGetDatum(parameter),
|
||||
PointerGetDatum(funcInfo),
|
||||
PointerGetDatum(predInfo));
|
||||
PointerGetDatum(predInfo),
|
||||
BoolGetDatum(unique),
|
||||
PointerGetDatum(RelationGetIndexStrategy(indexRelation)));
|
||||
else
|
||||
DefaultBuild(heapRelation,
|
||||
indexRelation,
|
||||
numberOfAttributes,
|
||||
attributeNumber,
|
||||
RelationGetIndexStrategy(indexRelation),
|
||||
parameterCount,
|
||||
parameter,
|
||||
funcInfo,
|
||||
predInfo);
|
||||
predInfo,
|
||||
unique,
|
||||
RelationGetIndexStrategy(indexRelation));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2016,51 +2015,6 @@ IndexIsUnique(Oid indexId)
|
||||
return index->indisunique;
|
||||
}
|
||||
|
||||
/*
|
||||
* IndexIsUniqueNoCache: same as above function, but don't use the
|
||||
* system cache. if we are called from btbuild, the transaction
|
||||
* that is adding the entry to pg_index has not been committed yet.
|
||||
* the system cache functions will do a heap scan, but only with
|
||||
* NowTimeQual, not SelfTimeQual, so it won't find tuples added
|
||||
* by the current transaction (which is good, because if the transaction
|
||||
* is aborted, you don't want the tuples sitting around in the cache).
|
||||
* so anyway, we have to do our own scan with SelfTimeQual.
|
||||
* this is only called when a new index is created, so it's OK
|
||||
* if it's slow.
|
||||
*/
|
||||
bool
|
||||
IndexIsUniqueNoCache(Oid indexId)
|
||||
{
|
||||
Relation pg_index;
|
||||
ScanKeyData skey[1];
|
||||
HeapScanDesc scandesc;
|
||||
HeapTuple tuple;
|
||||
Form_pg_index index;
|
||||
bool isunique;
|
||||
|
||||
pg_index = heap_openr(IndexRelationName, AccessShareLock);
|
||||
|
||||
ScanKeyEntryInitialize(&skey[0], (bits16) 0x0,
|
||||
Anum_pg_index_indexrelid,
|
||||
(RegProcedure) F_OIDEQ,
|
||||
ObjectIdGetDatum(indexId));
|
||||
|
||||
scandesc = heap_beginscan(pg_index, 0, SnapshotSelf, 1, skey);
|
||||
|
||||
/* NO CACHE */
|
||||
tuple = heap_getnext(scandesc, 0);
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
elog(ERROR, "IndexIsUniqueNoCache: can't find index id %u", indexId);
|
||||
|
||||
index = (Form_pg_index) GETSTRUCT(tuple);
|
||||
Assert(index->indexrelid == indexId);
|
||||
isunique = index->indisunique;
|
||||
|
||||
heap_endscan(scandesc);
|
||||
heap_close(pg_index, AccessShareLock);
|
||||
return isunique;
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------
|
||||
* activate_index -- activate/deactivate the specified index.
|
||||
@ -2102,6 +2056,7 @@ reindex_index(Oid indexId, bool force)
|
||||
*funcInfo = NULL;
|
||||
int i,
|
||||
numberOfAttributes;
|
||||
bool unique;
|
||||
char *predString;
|
||||
bool old;
|
||||
|
||||
@ -2121,6 +2076,7 @@ reindex_index(Oid indexId, bool force)
|
||||
index = (Form_pg_index) GETSTRUCT(indexTuple);
|
||||
heapId = index->indrelid;
|
||||
procId = index->indproc;
|
||||
unique = index->indisunique;
|
||||
|
||||
for (i = 0; i < INDEX_MAX_KEYS; i++)
|
||||
{
|
||||
@ -2189,7 +2145,7 @@ reindex_index(Oid indexId, bool force)
|
||||
/* Initialize the index and rebuild */
|
||||
InitIndexStrategy(numberOfAttributes, iRel, accessMethodId);
|
||||
index_build(heapRelation, iRel, numberOfAttributes,
|
||||
attributeNumberA, 0, NULL, funcInfo, predInfo);
|
||||
attributeNumberA, funcInfo, predInfo, unique);
|
||||
|
||||
/*
|
||||
* index_build will close both the heap and index relations (but not
|
||||
|
@ -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,
|
||||
|
@ -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 */
|
||||
}
|
||||
|
@ -9,7 +9,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.70 2000/06/15 06:07:34 tgl Exp $
|
||||
* $Header: /cvsroot/pgsql/src/backend/storage/large_object/inv_api.c,v 1.71 2000/06/17 23:41:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -165,7 +165,7 @@ inv_create(int flags)
|
||||
classObjectId[0] = INT4_OPS_OID;
|
||||
index_create(objname, indname, NULL, NULL, BTREE_AM_OID,
|
||||
1, &attNums[0], &classObjectId[0],
|
||||
0, (Datum) NULL, NULL, FALSE, FALSE, FALSE);
|
||||
(Node *) NULL, false, false, false);
|
||||
|
||||
/* make the index visible in this transaction */
|
||||
CommandCounterIncrement();
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: bootstrap.h,v 1.17 2000/01/26 05:57:53 momjian Exp $
|
||||
* $Id: bootstrap.h,v 1.18 2000/06/17 23:41:49 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -34,14 +34,11 @@ extern int numattr;
|
||||
extern int DebugMode;
|
||||
|
||||
extern int BootstrapMain(int ac, char *av[]);
|
||||
extern void index_register(char *heap,
|
||||
char *ind,
|
||||
int natts,
|
||||
AttrNumber *attnos,
|
||||
uint16 nparams,
|
||||
Datum *params,
|
||||
FuncIndexInfo *finfo,
|
||||
PredInfo *predInfo);
|
||||
|
||||
extern void index_register(char *heap, char *ind,
|
||||
int natts, AttrNumber *attnos,
|
||||
FuncIndexInfo *finfo, PredInfo *predInfo,
|
||||
bool unique);
|
||||
|
||||
extern void err_out(void);
|
||||
extern void InsertOneTuple(Oid objectid);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: index.h,v 1.24 2000/06/08 22:37:39 momjian Exp $
|
||||
* $Id: index.h,v 1.25 2000/06/17 23:41:51 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -33,8 +33,6 @@ extern void index_create(char *heapRelationName,
|
||||
int numatts,
|
||||
AttrNumber *attNums,
|
||||
Oid *classObjectId,
|
||||
uint16 parameterCount,
|
||||
Datum *parameter,
|
||||
Node *predicate,
|
||||
bool islossy,
|
||||
bool unique,
|
||||
@ -57,12 +55,11 @@ extern void FillDummyExprContext(ExprContext *econtext, TupleTableSlot *slot,
|
||||
TupleDesc tupdesc, Buffer buffer);
|
||||
|
||||
extern void index_build(Relation heapRelation, Relation indexRelation,
|
||||
int numberOfAttributes, AttrNumber *attributeNumber,
|
||||
uint16 parameterCount, Datum *parameter, FuncIndexInfo *funcInfo,
|
||||
PredInfo *predInfo);
|
||||
int numberOfAttributes, AttrNumber *attributeNumber,
|
||||
FuncIndexInfo *funcInfo, PredInfo *predInfo,
|
||||
bool unique);
|
||||
|
||||
extern bool IndexIsUnique(Oid indexId);
|
||||
extern bool IndexIsUniqueNoCache(Oid indexId);
|
||||
|
||||
extern bool reindex_index(Oid indexId, bool force);
|
||||
extern bool activate_indexes_of_a_table(Oid relid, bool activate);
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2000, PostgreSQL, Inc
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $Id: pg_proc.h,v 1.139 2000/06/13 07:35:19 tgl Exp $
|
||||
* $Id: pg_proc.h,v 1.140 2000/06/17 23:41:51 tgl Exp $
|
||||
*
|
||||
* NOTES
|
||||
* The script catalog/genbki.sh reads this file and generates .bki
|
||||
@ -677,7 +677,7 @@ DATA(insert OID = 321 ( rtdelete PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100
|
||||
DESCR("r-tree(internal)");
|
||||
DATA(insert OID = 322 ( rtgettuple PGUID 12 f t f t 2 f 23 "0 0" 100 0 0 100 rtgettuple - ));
|
||||
DESCR("r-tree(internal)");
|
||||
DATA(insert OID = 323 ( rtbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 rtbuild - ));
|
||||
DATA(insert OID = 323 ( rtbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 rtbuild - ));
|
||||
DESCR("r-tree(internal)");
|
||||
DATA(insert OID = 324 ( rtbeginscan PGUID 12 f t f t 4 f 23 "0 0 0 0" 100 0 0 100 rtbeginscan - ));
|
||||
DESCR("r-tree(internal)");
|
||||
@ -706,7 +706,7 @@ DATA(insert OID = 336 ( btmarkpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100
|
||||
DESCR("btree(internal)");
|
||||
DATA(insert OID = 337 ( btrestrpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 btrestrpos - ));
|
||||
DESCR("btree(internal)");
|
||||
DATA(insert OID = 338 ( btbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 btbuild - ));
|
||||
DATA(insert OID = 338 ( btbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 btbuild - ));
|
||||
DESCR("btree(internal)");
|
||||
|
||||
DATA(insert OID = 339 ( poly_same PGUID 11 f t t t 2 f 16 "604 604" 100 0 1 0 poly_same - ));
|
||||
@ -814,7 +814,7 @@ DATA(insert OID = 446 ( hashmarkpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100
|
||||
DESCR("hash(internal)");
|
||||
DATA(insert OID = 447 ( hashrestrpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 hashrestrpos - ));
|
||||
DESCR("hash(internal)");
|
||||
DATA(insert OID = 448 ( hashbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 hashbuild - ));
|
||||
DATA(insert OID = 448 ( hashbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 hashbuild - ));
|
||||
DESCR("hash(internal)");
|
||||
DATA(insert OID = 449 ( hashint2 PGUID 12 f t t t 1 f 23 "21" 100 0 0 100 hashint2 - ));
|
||||
DESCR("hash");
|
||||
@ -1040,7 +1040,7 @@ DATA(insert OID = 780 ( gistmarkpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100
|
||||
DESCR("gist(internal)");
|
||||
DATA(insert OID = 781 ( gistrestrpos PGUID 12 f t f t 1 f 23 "0" 100 0 0 100 gistrestrpos - ));
|
||||
DESCR("gist(internal)");
|
||||
DATA(insert OID = 782 ( gistbuild PGUID 12 f t f t 9 f 23 "0 0 0 0 0 0 0 0 0" 100 0 0 100 gistbuild - ));
|
||||
DATA(insert OID = 782 ( gistbuild PGUID 12 f t f t 8 f 23 "0 0 0 0 0 0 0 0" 100 0 0 100 gistbuild - ));
|
||||
DESCR("gist(internal)");
|
||||
|
||||
DATA(insert OID = 784 ( tintervaleq PGUID 12 f t f t 2 f 16 "704 704" 100 0 0 100 tintervaleq - ));
|
||||
|
Loading…
x
Reference in New Issue
Block a user