Skip to content

Commit b932b1b

Browse files
committed
Allow 8-key indexes.
1 parent 747e19a commit b932b1b

File tree

9 files changed

+21
-21
lines changed

9 files changed

+21
-21
lines changed

src/backend/access/index/istrat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.28 1998/09/01 04:26:56 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/access/index/Attic/istrat.c,v 1.29 1998/09/23 04:21:57 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -583,7 +583,7 @@ IndexSupportInitialize(IndexStrategy indexStrategy,
583583

584584
if (!OidIsValid(iform->indkey[attributeIndex]))
585585
{
586-
if (attributeIndex == 0)
586+
if (attributeIndex == InvalidAttrNumber)
587587
elog(ERROR, "IndexSupportInitialize: no pg_index tuple");
588588
break;
589589
}

src/backend/catalog/indexing.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.31 1998/09/07 05:35:39 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/catalog/indexing.c,v 1.32 1998/09/23 04:21:59 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -137,7 +137,7 @@ CatalogIndexInsert(Relation *idescs,
137137
* Compute the number of attributes we are indexing upon.
138138
*/
139139
for (attnumP = index_form->indkey, fatts = 0;
140-
*attnumP != InvalidAttrNumber && fatts < INDEX_MAX_KEYS;
140+
fatts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
141141
attnumP++, fatts++)
142142
;
143143
FIgetnArgs(&finfo) = fatts;

src/backend/commands/cluster.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*
1515
*
1616
* IDENTIFICATION
17-
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.31 1998/09/01 04:27:44 momjian Exp $
17+
* $Header: /cvsroot/pgsql/src/backend/commands/cluster.c,v 1.32 1998/09/23 04:22:01 momjian Exp $
1818
*
1919
*-------------------------------------------------------------------------
2020
*/
@@ -282,7 +282,7 @@ copy_index(Oid OIDOldIndex, Oid OIDNewHeap)
282282
* got to be sure.
283283
*/
284284
for (attnumP = &(Old_pg_index_Form->indkey[0]), natts = 0;
285-
*attnumP != InvalidAttrNumber;
285+
natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
286286
attnumP++, natts++);
287287

288288
/*

src/backend/commands/copy.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*
77
*
88
* IDENTIFICATION
9-
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.61 1998/09/08 22:15:42 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/backend/commands/copy.c,v 1.62 1998/09/23 04:22:02 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -453,7 +453,7 @@ CopyFrom(Relation rel, bool binary, bool oids, FILE *fp, char *delim)
453453
Assert(pgIndexTup);
454454
pgIndexP[i] = (Form_pg_index) GETSTRUCT(pgIndexTup);
455455
for (attnumP = &(pgIndexP[i]->indkey[0]), natts = 0;
456-
*attnumP != InvalidAttrNumber;
456+
natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
457457
attnumP++, natts++);
458458
if (pgIndexP[i]->indproc != InvalidOid)
459459
{

src/backend/commands/defind.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.26 1998/09/01 04:27:52 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/Attic/defind.c,v 1.27 1998/09/23 04:22:03 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -274,7 +274,7 @@ ExtendIndex(char *indexRelationName, Expr *predicate, List *rangetable)
274274
indproc = index->indproc;
275275

276276
for (i = 0; i < INDEX_MAX_KEYS; i++)
277-
if (index->indkey[i] == 0)
277+
if (index->indkey[i] == InvalidAttrNumber)
278278
break;
279279
numberOfAttributes = i;
280280

src/backend/commands/vacuum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.81 1998/09/02 23:05:25 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/commands/vacuum.c,v 1.82 1998/09/23 04:22:05 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -2227,7 +2227,7 @@ vc_mkindesc(Relation onerel, int nindices, Relation *Irel, IndDesc **Idesc)
22272227
*/
22282228
idcur->tform = (Form_pg_index) GETSTRUCT(cachetuple);
22292229
for (attnumP = &(idcur->tform->indkey[0]), natts = 0;
2230-
*attnumP != InvalidAttrNumber && natts != INDEX_MAX_KEYS;
2230+
natts < INDEX_MAX_KEYS && *attnumP != InvalidAttrNumber;
22312231
attnumP++, natts++);
22322232
if (idcur->tform->indproc != InvalidOid)
22332233
{

src/backend/executor/execUtils.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.38 1998/09/01 04:28:22 momjian Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.39 1998/09/23 04:22:06 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -629,7 +629,8 @@ ExecGetIndexKeyInfo(Form_pg_index indexTuple,
629629
* ----------------
630630
*/
631631
numKeys = 0;
632-
for (i = 0; i < 8 && indexTuple->indkey[i] != 0; i++)
632+
for (i = 0; i < INDEX_MAX_KEYS &&
633+
indexTuple->indkey[i] != InvalidAttrNumber; i++)
633634
numKeys++;
634635

635636
/* ----------------
@@ -663,8 +664,7 @@ ExecGetIndexKeyInfo(Form_pg_index indexTuple,
663664
*/
664665
CXT1_printf("ExecGetIndexKeyInfo: context is %d\n", CurrentMemoryContext);
665666

666-
attKeys = (AttrNumber *)
667-
palloc(numKeys * sizeof(AttrNumber));
667+
attKeys = (AttrNumber *)palloc(numKeys * sizeof(AttrNumber));
668668

669669
for (i = 0; i < numKeys; i++)
670670
attKeys[i] = indexTuple->indkey[i];

src/backend/optimizer/util/plancat.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.21 1998/09/01 04:30:09 momjian Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/optimizer/util/plancat.c,v 1.22 1998/09/23 04:22:10 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -165,9 +165,9 @@ index_info(Query *root, bool first, int relid, IdxInfoRetval *info)
165165
/* Extract info from the index tuple */
166166
index = (Form_pg_index) GETSTRUCT(indexTuple);
167167
info->relid = index->indexrelid; /* index relation */
168-
for (i = 0; i < 8; i++)
168+
for (i = 0; i < INDEX_MAX_KEYS; i++)
169169
info->indexkeys[i] = index->indkey[i];
170-
for (i = 0; i < 8; i++)
170+
for (i = 0; i < INDEX_MAX_KEYS; i++)
171171
info->classlist[i] = index->indclass[i];
172172

173173
info->indproc = index->indproc; /* functional index ?? */

src/bin/pg_dump/pg_dump.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*
2222
*
2323
* IDENTIFICATION
24-
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.85 1998/09/20 03:18:43 momjian Exp $
24+
* $Header: /cvsroot/pgsql/src/bin/pg_dump/pg_dump.c,v 1.86 1998/09/23 04:22:14 momjian Exp $
2525
*
2626
* Modifications - 6/10/96 - dave@bensoft.com - version 1.13.dhb
2727
*
@@ -2649,7 +2649,7 @@ dumpIndices(FILE *fout, IndInfo *indinfo, int numIndices,
26492649
char *attname;
26502650

26512651
indkey = atoi(indinfo[i].indkey[k]);
2652-
if (indkey == 0)
2652+
if (indkey == InvalidAttrNumber)
26532653
break;
26542654
indkey--;
26552655
if (indkey == ObjectIdAttributeNumber - 1)

0 commit comments

Comments
 (0)