Commit b932b1b1 authored by Bruce Momjian's avatar Bruce Momjian

Allow 8-key indexes.

parent 747e19aa
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.28 1998/09/01 04:26:56 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.29 1998/09/23 04:21:57 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -583,7 +583,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy, ...@@ -583,7 +583,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
if (!OidIsValid(iform->indkey[attributeIndex])) if (!OidIsValid(iform->indkey[attributeIndex]))
{ {
if (attributeIndex == 0) if (attributeIndex == InvalidAttrNumber)
elog(ERROR, "IndexSupportInitialize: no pg_index tuple"); elog(ERROR, "IndexSupportInitialize: no pg_index tuple");
break; break;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.31 1998/09/07 05:35:39 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.32 1998/09/23 04:21:59 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -137,7 +137,7 @@ CatalogIndexInsert(Relation *idescs, ...@@ -137,7 +137,7 @@ CatalogIndexInsert(Relation *idescs,
* Compute the number of attributes we are indexing upon. * Compute the number of attributes we are indexing upon.
*/ */
for (attnumP = index_form->indkey, fatts = 0; for (attnumP = index_form->indkey, fatts = 0;
*attnumP != InvalidAttrNumber && fatts < INDEX_MAX_KEYS; fatts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
attnumP++, fatts++) attnumP++, fatts++)
; ;
FIgetnArgs(&finfo) = fatts; FIgetnArgs(&finfo) = fatts;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.31 1998/09/01 04:27:44 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.32 1998/09/23 04:22:01 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -282,7 +282,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap) ...@@ -282,7 +282,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
* got to be sure. * got to be sure.
*/ */
for (attnumP = &(Old_pg_index_Form->indkey[0]), natts = 0; for (attnumP = &(Old_pg_index_Form->indkey[0]), natts = 0;
*attnumP != InvalidAttrNumber; natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
attnumP++, natts++); attnumP++, natts++);
/* /*
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.61 1998/09/08 22:15:42 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.62 1998/09/23 04:22:02 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -453,7 +453,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim) ...@@ -453,7 +453,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
Assert(pgIndexTup); Assert(pgIndexTup);
pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup); pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup);
for (attnumP = &(pgIndexP[i]->indkey[0]), natts = 0; for (attnumP = &(pgIndexP[i]->indkey[0]), natts = 0;
*attnumP != InvalidAttrNumber; natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
attnumP++, natts++); attnumP++, natts++);
if (pgIndexP[i]->indproc != InvalidOid) if (pgIndexP[i]->indproc != InvalidOid)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.26 1998/09/01 04:27:52 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.27 1998/09/23 04:22:03 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -274,7 +274,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable) ...@@ -274,7 +274,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
indproc = index->indproc; indproc = index->indproc;
for (i = 0; i < INDEX_MAX_KEYS; i++) for (i = 0; i < INDEX_MAX_KEYS; i++)
if (index->indkey[i] == 0) if (index->indkey[i] == InvalidAttrNumber)
break; break;
numberOfAttributes = i; numberOfAttributes = i;
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.81 1998/09/02 23:05:25 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.82 1998/09/23 04:22:05 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -2227,7 +2227,7 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc) ...@@ -2227,7 +2227,7 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc)
*/ */
idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple); idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple);
for (attnumP = &(idcur->tform->indkey[0]), natts = 0; for (attnumP = &(idcur->tform->indkey[0]), natts = 0;
*attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS; natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
attnumP++, natts++); attnumP++, natts++);
if (idcur->tform->indproc != InvalidOid) if (idcur->tform->indproc != InvalidOid)
{ {
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.38 1998/09/01 04:28:22 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.39 1998/09/23 04:22:06 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -629,7 +629,8 @@ ExecGetIndexKeyInfo(Form_pg_index indexTuple, ...@@ -629,7 +629,8 @@ ExecGetIndexKeyInfo(Form_pg_index indexTuple,
* ---------------- * ----------------
*/ */
numKeys = 0; numKeys = 0;
for (i = 0; i < 8 && indexTuple->indkey[i] != 0; i++) for (i = 0; i < INDEX_MAX_KEYS &&
indexTuple->indkey[i] != InvalidAttrNumber; i++)
numKeys++; numKeys++;
/* ---------------- /* ----------------
...@@ -663,8 +664,7 @@ ExecGetIndexKeyInfo(Form_pg_index indexTuple, ...@@ -663,8 +664,7 @@ ExecGetIndexKeyInfo(Form_pg_index indexTuple,
*/ */
CXT1_printf("ExecGetIndexKeyInfo: context is %d\n", CurrentMemoryContext); CXT1_printf("ExecGetIndexKeyInfo: context is %d\n", CurrentMemoryContext);
attKeys = (AttrNumber *) attKeys = (AttrNumber *)palloc(numKeys * sizeof(AttrNumber));
palloc(numKeys * sizeof(AttrNumber));
for (i = 0; i < numKeys; i++) for (i = 0; i < numKeys; i++)
attKeys[i] = indexTuple->indkey[i]; attKeys[i] = indexTuple->indkey[i];
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.21 1998/09/01 04:30:09 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.22 1998/09/23 04:22:10 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -165,9 +165,9 @@ index_info(Query *root, bool first, int relid, IdxInfoRetval *info) ...@@ -165,9 +165,9 @@ index_info(Query *root, bool first, int relid, IdxInfoRetval *info)
/* Extract info from the index tuple */ /* Extract info from the index tuple */
index = (Form_pg_index) GETSTRUCT(indexTuple); index = (Form_pg_index) GETSTRUCT(indexTuple);
info->relid = index->indexrelid; /* index relation */ info->relid = index->indexrelid; /* index relation */
for (i = 0; i < 8; i++) for (i = 0; i < INDEX_MAX_KEYS; i++)
info->indexkeys[i] = index->indkey[i]; info->indexkeys[i] = index->indkey[i];
for (i = 0; i < 8; i++) for (i = 0; i < INDEX_MAX_KEYS; i++)
info->classlist[i] = index->indclass[i]; info->classlist[i] = index->indclass[i];
info->indproc = index->indproc; /* functional index ?? */ info->indproc = index->indproc; /* functional index ?? */
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.85 1998/09/20 03:18:43 momjian Exp $ * $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.86 1998/09/23 04:22:14 momjian Exp $
* *
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb * Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
* *
...@@ -2649,7 +2649,7 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices, ...@@ -2649,7 +2649,7 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
char *attname; char *attname;
indkey = atoi(indinfo[i].indkey[k]); indkey = atoi(indinfo[i].indkey[k]);
if (indkey == 0) if (indkey == InvalidAttrNumber)
break; break;
indkey--; indkey--;
if (indkey == ObjectIdAttributeNumber - 1) if (indkey == ObjectIdAttributeNumber - 1)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment