From b932b1b1c4e48fda3086c896506388a26a858626 Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Wed, 23 Sep 1998 04:22:14 +0000 Subject: [PATCH] Allow 8-key indexes. --- src/backend/access/index/istrat.c | 4 ++-- src/backend/catalog/indexing.c | 4 ++-- src/backend/commands/cluster.c | 4 ++-- src/backend/commands/copy.c | 4 ++-- src/backend/commands/defind.c | 4 ++-- src/backend/commands/vacuum.c | 4 ++-- src/backend/executor/execUtils.c | 8 ++++---- src/backend/optimizer/util/plancat.c | 6 +++--- src/bin/pg_dump/pg_dump.c | 4 ++-- 9 files changed, 21 insertions(+), 21 deletions(-) diff --git a/src/backend/access/index/istrat.c b/src/backend/access/index/istrat.c index 403a51f3ba..ca4f6eeaeb 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.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, if (!OidIsValid(iform->indkey[attributeIndex])) { - if (attributeIndex == 0) + if (attributeIndex == InvalidAttrNumber) elog(ERROR, "IndexSupportInitialize: no pg_index tuple"); break; } diff --git a/src/backend/catalog/indexing.c b/src/backend/catalog/indexing.c index 2fae397900..b3c9db48b8 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.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, * Compute the number of attributes we are indexing upon. */ for (attnumP = index_form->indkey, fatts = 0; - *attnumP != InvalidAttrNumber && fatts < INDEX_MAX_KEYS; + fatts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber; attnumP++, fatts++) ; FIgetnArgs(&finfo) = fatts; diff --git a/src/backend/commands/cluster.c b/src/backend/commands/cluster.c index 415ad4a8df..3fba38a351 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.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) * got to be sure. */ for (attnumP = &(Old_pg_index_Form->indkey[0]), natts = 0; - *attnumP != InvalidAttrNumber; + natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber; attnumP++, natts++); /* diff --git a/src/backend/commands/copy.c b/src/backend/commands/copy.c index 8e1b2cb75e..c6fcb958e5 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.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) Assert(pgIndexTup); pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup); for (attnumP = &(pgIndexP[i]->indkey[0]), natts = 0; - *attnumP != InvalidAttrNumber; + natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber; attnumP++, natts++); if (pgIndexP[i]->indproc != InvalidOid) { diff --git a/src/backend/commands/defind.c b/src/backend/commands/defind.c index ab6e26f1e1..f0d985d3a9 100644 --- a/src/backend/commands/defind.c +++ b/src/backend/commands/defind.c @@ -7,7 +7,7 @@ * * * 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) indproc = index->indproc; for (i = 0; i < INDEX_MAX_KEYS; i++) - if (index->indkey[i] == 0) + if (index->indkey[i] == InvalidAttrNumber) break; numberOfAttributes = i; diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index d40f7d5055..a39355e195 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.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) */ idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple); for (attnumP = &(idcur->tform->indkey[0]), natts = 0; - *attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS; + natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber; attnumP++, natts++); if (idcur->tform->indproc != InvalidOid) { diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index fb83fd6e55..3f9e82902d 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.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, * ---------------- */ 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++; /* ---------------- @@ -663,8 +664,7 @@ ExecGetIndexKeyInfo(Form_pg_index indexTuple, */ CXT1_printf("ExecGetIndexKeyInfo: context is %d\n", CurrentMemoryContext); - attKeys = (AttrNumber *) - palloc(numKeys * sizeof(AttrNumber)); + attKeys = (AttrNumber *)palloc(numKeys * sizeof(AttrNumber)); for (i = 0; i < numKeys; i++) attKeys[i] = indexTuple->indkey[i]; diff --git a/src/backend/optimizer/util/plancat.c b/src/backend/optimizer/util/plancat.c index 786947e809..a27989184f 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.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) /* Extract info from the index tuple */ index = (Form_pg_index) GETSTRUCT(indexTuple); 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]; - for (i = 0; i < 8; i++) + for (i = 0; i < INDEX_MAX_KEYS; i++) info->classlist[i] = index->indclass[i]; info->indproc = index->indproc; /* functional index ?? */ diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c index 24f8c4e36e..63d81ac0b7 100644 --- a/src/bin/pg_dump/pg_dump.c +++ b/src/bin/pg_dump/pg_dump.c @@ -21,7 +21,7 @@ * * * 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 * @@ -2649,7 +2649,7 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices, char *attname; indkey = atoi(indinfo[i].indkey[k]); - if (indkey == 0) + if (indkey == InvalidAttrNumber) break; indkey--; if (indkey == ObjectIdAttributeNumber - 1)