mirror of
https://github.com/postgres/postgres.git
synced 2025-06-26 12:21:12 +03:00
Move INDEX_MAX_KEYS to postgres.h, and make it configurable for users.
This commit is contained in:
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* 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)
|
oid8in(char *oidString)
|
||||||
{
|
{
|
||||||
Oid *result;
|
Oid *result;
|
||||||
int nums;
|
int slot;
|
||||||
|
|
||||||
if (oidString == NULL)
|
if (oidString == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
result = (Oid *) palloc(sizeof(Oid[8]));
|
result = (Oid *) palloc(sizeof(Oid[INDEX_MAX_KEYS]));
|
||||||
if ((nums = sscanf(oidString, "%u%u%u%u%u%u%u%u",
|
|
||||||
&result[0],
|
for (slot=0; *oidString && slot < INDEX_MAX_KEYS; slot++)
|
||||||
&result[1],
|
|
||||||
&result[2],
|
|
||||||
&result[3],
|
|
||||||
&result[4],
|
|
||||||
&result[5],
|
|
||||||
&result[6],
|
|
||||||
&result[7])) != 8)
|
|
||||||
{
|
{
|
||||||
do
|
if (sscanf(oidString, "%u", &result[slot]) != 1)
|
||||||
result[nums++] = 0;
|
break;
|
||||||
while (nums < 8);
|
while (*oidString && *oidString != ' ')
|
||||||
|
oidString++;
|
||||||
}
|
}
|
||||||
|
while (slot < INDEX_MAX_KEYS)
|
||||||
|
result[slot++] = 0;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,9 +70,9 @@ oid8out(Oid *oidArray)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* assumes sign, 10 digits, ' ' */
|
/* assumes sign, 10 digits, ' ' */
|
||||||
rp = result = (char *) palloc(8 * 12);
|
rp = result = (char *) palloc(INDEX_MAX_KEYS * 12);
|
||||||
sp = oidArray;
|
sp = oidArray;
|
||||||
for (num = 8; num != 0; num--)
|
for (num = INDEX_MAX_KEYS; num != 0; num--)
|
||||||
{
|
{
|
||||||
ltoa(*sp++, rp);
|
ltoa(*sp++, rp);
|
||||||
while (*++rp != '\0')
|
while (*++rp != '\0')
|
||||||
@ -121,13 +118,13 @@ oidne(Oid arg1, Oid arg2)
|
|||||||
bool
|
bool
|
||||||
oid8eq(Oid *arg1, Oid *arg2)
|
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
|
bool
|
||||||
oid8ne(Oid *arg1, Oid *arg2)
|
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
|
bool
|
||||||
@ -135,7 +132,7 @@ oid8lt(Oid *arg1, Oid *arg2)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < INDEX_MAX_KEYS; i++)
|
||||||
if (!int4eq(arg1[i], arg2[i]))
|
if (!int4eq(arg1[i], arg2[i]))
|
||||||
return int4lt(arg1[i], arg2[i]);
|
return int4lt(arg1[i], arg2[i]);
|
||||||
return false;
|
return false;
|
||||||
@ -146,7 +143,7 @@ oid8le(Oid *arg1, Oid *arg2)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < INDEX_MAX_KEYS; i++)
|
||||||
if (!int4eq(arg1[i], arg2[i]))
|
if (!int4eq(arg1[i], arg2[i]))
|
||||||
return int4le(arg1[i], arg2[i]);
|
return int4le(arg1[i], arg2[i]);
|
||||||
return true;
|
return true;
|
||||||
@ -157,7 +154,7 @@ oid8ge(Oid *arg1, Oid *arg2)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < INDEX_MAX_KEYS; i++)
|
||||||
if (!int4eq(arg1[i], arg2[i]))
|
if (!int4eq(arg1[i], arg2[i]))
|
||||||
return int4ge(arg1[i], arg2[i]);
|
return int4ge(arg1[i], arg2[i]);
|
||||||
return true;
|
return true;
|
||||||
@ -168,7 +165,7 @@ oid8gt(Oid *arg1, Oid *arg2)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < INDEX_MAX_KEYS; i++)
|
||||||
if (!int4eq(arg1[i], arg2[i]))
|
if (!int4eq(arg1[i], arg2[i]))
|
||||||
return int4gt(arg1[i], arg2[i]);
|
return int4gt(arg1[i], arg2[i]);
|
||||||
return false;
|
return false;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Copyright (c) 1994, Regents of the University of California
|
* 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
|
* NOTES
|
||||||
* the genbki.sh script reads this file and generates .bki
|
* 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 */
|
text indpred; /* query plan for partial index predicate */
|
||||||
} FormData_pg_index;
|
} 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
|
* Form_pg_index corresponds to a pointer to a tuple with
|
||||||
* the format of pg_index relation.
|
* the format of pg_index relation.
|
||||||
|
@ -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.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 bytea;
|
||||||
typedef struct varlena text;
|
typedef struct varlena text;
|
||||||
|
|
||||||
typedef int2 int28[8];
|
#define INDEX_MAX_KEYS 8 /* maximum number of keys in an index
|
||||||
typedef Oid oid8[8];
|
* definition */
|
||||||
|
typedef int2 int28[INDEX_MAX_KEYS];
|
||||||
|
typedef Oid oid8[INDEX_MAX_KEYS];
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user