]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Move INDEX_MAX_KEYS to postgres.h, and make it configurable for users.
authorBruce Momjian <bruce@momjian.us>
Mon, 10 Jan 2000 04:36:37 +0000 (04:36 +0000)
committerBruce Momjian <bruce@momjian.us>
Mon, 10 Jan 2000 04:36:37 +0000 (04:36 +0000)
src/backend/utils/adt/oid.c
src/include/catalog/pg_index.h
src/include/postgres.h

index ab53a4e86c0a9d79f5b3d20b7ae1a962741af76a..5ca8061339bc152310158ab30734a1de44556cc3 100644 (file)
@@ -7,7 +7,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.28 1999/07/17 20:17:58 momjian Exp $
+ *       $Header: /cvsroot/pgsql/src/backend/utils/adt/oid.c,v 1.29 2000/01/10 04:36:34 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -30,26 +30,23 @@ Oid *
 oid8in(char *oidString)
 {
        Oid                *result;
-       int                     nums;
+       int                     slot;
 
        if (oidString == NULL)
                return NULL;
 
-       result = (Oid *) palloc(sizeof(Oid[8]));
-       if ((nums = sscanf(oidString, "%u%u%u%u%u%u%u%u",
-                                          &result[0],
-                                          &result[1],
-                                          &result[2],
-                                          &result[3],
-                                          &result[4],
-                                          &result[5],
-                                          &result[6],
-                                          &result[7])) != 8)
+       result = (Oid *) palloc(sizeof(Oid[INDEX_MAX_KEYS]));
+
+       for (slot=0; *oidString && slot < INDEX_MAX_KEYS; slot++)
        {
-               do
-                       result[nums++] = 0;
-               while (nums < 8);
+               if (sscanf(oidString, "%u", &result[slot]) != 1)
+                       break;
+               while (*oidString && *oidString != ' ')
+                       oidString++;
        }
+       while (slot < INDEX_MAX_KEYS)
+               result[slot++] = 0;
+
        return result;
 }
 
@@ -73,9 +70,9 @@ oid8out(Oid *oidArray)
        }
 
        /* assumes sign, 10 digits, ' ' */
-       rp = result = (char *) palloc(8 * 12);
+       rp = result = (char *) palloc(INDEX_MAX_KEYS * 12);
        sp = oidArray;
-       for (num = 8; num != 0; num--)
+       for (num = INDEX_MAX_KEYS; num != 0; num--)
        {
                ltoa(*sp++, rp);
                while (*++rp != '\0')
@@ -121,13 +118,13 @@ oidne(Oid arg1, Oid arg2)
 bool
 oid8eq(Oid *arg1, Oid *arg2)
 {
-       return (bool) (memcmp(arg1, arg2, 8 * sizeof(Oid)) == 0);
+       return (bool) (memcmp(arg1, arg2, INDEX_MAX_KEYS * sizeof(Oid)) == 0);
 }
 
 bool
 oid8ne(Oid *arg1, Oid *arg2)
 {
-       return (bool) (memcmp(arg1, arg2, 8 * sizeof(Oid)) != 0);
+       return (bool) (memcmp(arg1, arg2, INDEX_MAX_KEYS * sizeof(Oid)) != 0);
 }
 
 bool
@@ -135,7 +132,7 @@ oid8lt(Oid *arg1, Oid *arg2)
 {
        int                     i;
 
-       for (i = 0; i < 8; i++)
+       for (i = 0; i < INDEX_MAX_KEYS; i++)
                if (!int4eq(arg1[i], arg2[i]))
                        return int4lt(arg1[i], arg2[i]);
        return false;
@@ -146,7 +143,7 @@ oid8le(Oid *arg1, Oid *arg2)
 {
        int                     i;
 
-       for (i = 0; i < 8; i++)
+       for (i = 0; i < INDEX_MAX_KEYS; i++)
                if (!int4eq(arg1[i], arg2[i]))
                        return int4le(arg1[i], arg2[i]);
        return true;
@@ -157,7 +154,7 @@ oid8ge(Oid *arg1, Oid *arg2)
 {
        int                     i;
 
-       for (i = 0; i < 8; i++)
+       for (i = 0; i < INDEX_MAX_KEYS; i++)
                if (!int4eq(arg1[i], arg2[i]))
                        return int4ge(arg1[i], arg2[i]);
        return true;
@@ -168,7 +165,7 @@ oid8gt(Oid *arg1, Oid *arg2)
 {
        int                     i;
 
-       for (i = 0; i < 8; i++)
+       for (i = 0; i < INDEX_MAX_KEYS; i++)
                if (!int4eq(arg1[i], arg2[i]))
                        return int4gt(arg1[i], arg2[i]);
        return false;
index ee0fa2284f10f663f2940dd1b8b3b052329e94b9..5ab3af31e5c920de66db4967ee4906375767b99d 100644 (file)
@@ -7,7 +7,7 @@
  *
  * Copyright (c) 1994, Regents of the University of California
  *
- * $Id: pg_index.h,v 1.12 1999/05/25 16:13:45 momjian Exp $
+ * $Id: pg_index.h,v 1.13 2000/01/10 04:36:37 momjian Exp $
  *
  * NOTES
  *       the genbki.sh script reads this file and generates .bki
@@ -58,9 +58,6 @@ CATALOG(pg_index)
        text            indpred;                /* query plan for partial index predicate */
 } FormData_pg_index;
 
-#define INDEX_MAX_KEYS 8               /* maximum number of keys in an index
-                                                                * definition */
-
 /* ----------------
  *             Form_pg_index corresponds to a pointer to a tuple with
  *             the format of pg_index relation.
index e03922ceda458b9cc24d62303d2da65cf8a5952b..6d9c2bfd81ee915e36896261013e7ef55dee65ae 100644 (file)
@@ -6,7 +6,7 @@
  *
  * Copyright (c) 1995, Regents of the University of California
  *
- * $Id: postgres.h,v 1.31 1999/12/21 00:06:41 wieck Exp $
+ * $Id: postgres.h,v 1.32 2000/01/10 04:36:36 momjian Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -101,8 +101,10 @@ struct varlena
 typedef struct varlena bytea;
 typedef struct varlena text;
 
-typedef int2 int28[8];
-typedef Oid oid8[8];
+#define INDEX_MAX_KEYS 8               /* maximum number of keys in an index
+                                                                * definition */
+typedef int2 int28[INDEX_MAX_KEYS];
+typedef Oid oid8[INDEX_MAX_KEYS];
 
 
 /*