Commit a0402817 authored by Bruce Momjian's avatar Bruce Momjian

Move fixes for >8 indexed fields.

parent b99f3006
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* Copyright (c) 1994, Regents of the University of California * Copyright (c) 1994, Regents of the University of California
* *
* $Id: analyze.c,v 1.127 2000/01/06 20:46:49 wieck Exp $ * $Id: analyze.c,v 1.128 2000/01/10 05:20:21 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -1679,7 +1679,7 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint) ...@@ -1679,7 +1679,7 @@ transformFkeyGetPrimaryKey(FkConstraint *fkconstraint)
* using the attribute names of the PK relation descriptor * using the attribute names of the PK relation descriptor
* ---------- * ----------
*/ */
for (i = 0; i < 8 && indexStruct->indkey[i] != 0; i++) for (i = 0; i < INDEX_MAX_KEYS && indexStruct->indkey[i] != 0; i++)
{ {
pkattno = indexStruct->indkey[i]; pkattno = indexStruct->indkey[i];
pkattr = (Ident *)makeNode(Ident); pkattr = (Ident *)makeNode(Ident);
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.27 1999/07/17 20:17:56 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/int.c,v 1.28 2000/01/10 05:20:23 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -76,29 +76,26 @@ int2out(int16 sh) ...@@ -76,29 +76,26 @@ int2out(int16 sh)
* Fills any nonexistent digits with NULLs. * Fills any nonexistent digits with NULLs.
*/ */
int16 * int16 *
int28in(char *shs) int28in(char *intString)
{ {
int16 *result; int16 *result;
int nums; int slot;
if (shs == NULL) if (intString == NULL)
return NULL; return NULL;
result = (int16 *) palloc(sizeof(int16[8])); result = (int16 *) palloc(sizeof(int16[INDEX_MAX_KEYS]));
if ((nums = sscanf(shs, "%hd%hd%hd%hd%hd%hd%hd%hd",
&result[0], for (slot=0; *intString && slot < INDEX_MAX_KEYS; slot++)
&result[1],
&result[2],
&result[3],
&result[4],
&result[5],
&result[6],
&result[7])) != 8)
{ {
do if (sscanf(intString, "%hd", &result[slot]) != 1)
result[nums++] = 0; break;
while (nums < 8); while (*intString && *intString != ' ')
intString++;
} }
while (slot < INDEX_MAX_KEYS)
result[slot++] = 0;
return result; return result;
} }
...@@ -120,10 +117,10 @@ int28out(int16 *shs) ...@@ -120,10 +117,10 @@ int28out(int16 *shs)
result[1] = '\0'; result[1] = '\0';
return result; return result;
} }
rp = result = (char *) palloc(8 * 7); /* assumes sign, 5 digits, rp = result = (char *) palloc(INDEX_MAX_KEYS * 7);
* ' ' */ /* assumes sign, 5 digits, ' ' */
sp = shs; sp = shs;
for (num = 8; num != 0; num--) for (num = INDEX_MAX_KEYS; num != 0; num--)
{ {
itoa(*sp++, rp); itoa(*sp++, rp);
while (*++rp != '\0') while (*++rp != '\0')
......
...@@ -541,7 +541,7 @@ xmalloc(size_t size) ...@@ -541,7 +541,7 @@ xmalloc(size_t size)
bool bool
describeTableDetails(const char *name, PsqlSettings *pset, bool desc) describeTableDetails(const char *name, PsqlSettings *pset, bool desc)
{ {
char buf[512 + 8 * NAMEDATALEN]; char buf[512 + INDEX_MAX_KEYS * NAMEDATALEN];
PGresult *res = NULL; PGresult *res = NULL;
printTableOpt myopt = pset->popt.topt; printTableOpt myopt = pset->popt.topt;
int i; int i;
......
...@@ -92,6 +92,11 @@ ...@@ -92,6 +92,11 @@
*/ */
#define INDEXSCAN_PATCH #define INDEXSCAN_PATCH
/*
* Maximum number of columns in an index.
*/
#define INDEX_MAX_KEYS 8
/* /*
* Enables debugging print statements in the date/time support routines. * Enables debugging print statements in the date/time support routines.
* Particularly useful for porting to a new platform/OS combination. * Particularly useful for porting to a new platform/OS combination.
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* *
* Copyright (c) 1995, Regents of the University of California * Copyright (c) 1995, Regents of the University of California
* *
* $Id: postgres.h,v 1.32 2000/01/10 04:36:36 momjian Exp $ * $Id: postgres.h,v 1.33 2000/01/10 05:20:26 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -101,8 +101,6 @@ struct varlena ...@@ -101,8 +101,6 @@ struct varlena
typedef struct varlena bytea; typedef struct varlena bytea;
typedef struct varlena text; typedef struct varlena text;
#define INDEX_MAX_KEYS 8 /* maximum number of keys in an index
* definition */
typedef int2 int28[INDEX_MAX_KEYS]; typedef int2 int28[INDEX_MAX_KEYS];
typedef Oid oid8[INDEX_MAX_KEYS]; typedef Oid oid8[INDEX_MAX_KEYS];
......
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