Skip to content

Commit 5c2fb2a

Browse files
committed
Use symbolic INDEX_MAX_KEYS in pg_type entries for oidvector
and int2vector.
1 parent c2fa275 commit 5c2fb2a

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

src/backend/catalog/genbki.sh.in

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111
#
1212
# IDENTIFICATION
13-
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh.in,v 1.4 1999/11/04 08:00:56 inoue Exp $
13+
# $Header: /cvsroot/pgsql/src/backend/catalog/Attic/genbki.sh.in,v 1.5 2000/01/11 04:02:28 tgl Exp $
1414
#
1515
# NOTES
1616
# non-essential whitespace is removed from the generated file.
@@ -53,7 +53,17 @@ while test $x -le $numargs ; do
5353
done
5454

5555
# Get NAMEDATALEN from postgres_ext.h
56-
NAMEDATALEN=`grep '#define.*NAMEDATALEN' ../../include/postgres_ext.h | awk '{ print $3 }'`
56+
NAMEDATALEN=`grep '#define[ ]*NAMEDATALEN' ../../include/postgres_ext.h | awk '{ print $3 }'`
57+
58+
# Get INDEX_MAX_KEYS from config.h (who needs consistency?)
59+
INDEXMAXKEYS=`grep '#define[ ]*INDEX_MAX_KEYS' ../../include/config.h | awk '{ print $3 }'`
60+
61+
# NOTE: we assume here that FUNC_MAX_ARGS has the same value as INDEX_MAX_KEYS,
62+
# and don't read it separately from config.h. This is OK because both of them
63+
# must be equal to the length of oidvector.
64+
65+
INDEXMAXKEYS2=`expr $INDEXMAXKEYS '*' 2`
66+
INDEXMAXKEYS4=`expr $INDEXMAXKEYS '*' 4`
5767

5868
# ----------------
5969
# strip comments and trash from .h before we generate
@@ -80,6 +90,12 @@ sed -e "s/;[ ]*$//g" \
8090
-e "s/(NameData/(name/g" \
8191
-e "s/(Oid/(oid/g" \
8292
-e "s/NAMEDATALEN/$NAMEDATALEN/g" \
93+
-e "s/INDEX_MAX_KEYS\*2/$INDEXMAXKEYS2/g" \
94+
-e "s/INDEX_MAX_KEYS\*4/$INDEXMAXKEYS4/g" \
95+
-e "s/INDEX_MAX_KEYS/$INDEXMAXKEYS/g" \
96+
-e "s/FUNC_MAX_ARGS\*2/$INDEXMAXKEYS2/g" \
97+
-e "s/FUNC_MAX_ARGS\*4/$INDEXMAXKEYS4/g" \
98+
-e "s/FUNC_MAX_ARGS/$INDEXMAXKEYS/g" \
8399
| awk '
84100
# ----------------
85101
# now use awk to process remaining .h file..

src/include/catalog/pg_type.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Copyright (c) 1994, Regents of the University of California
99
*
10-
* $Id: pg_type.h,v 1.74 2000/01/10 20:23:31 momjian Exp $
10+
* $Id: pg_type.h,v 1.75 2000/01/11 04:02:28 tgl Exp $
1111
*
1212
* NOTES
1313
* the genbki.sh script reads this file and generates .bki
@@ -174,8 +174,8 @@ DATA(insert OID = 21 ( int2 PGUID 2 5 t b t \054 0 0 int2in int2out int2
174174
DESCR("-32 thousand to 32 thousand, 2-byte storage");
175175
#define INT2OID 21
176176

177-
DATA(insert OID = 22 ( int2vector PGUID 32 113 f b t \054 0 21 int2vectorin int2vectorout int2vectorin int2vectorout i _null_ ));
178-
DESCR("16 int2 integers, used internally");
177+
DATA(insert OID = 22 ( int2vector PGUID INDEX_MAX_KEYS*2 -1 f b t \054 0 21 int2vectorin int2vectorout int2vectorin int2vectorout i _null_ ));
178+
DESCR("array of INDEX_MAX_KEYS int2 integers, used in system tables");
179179
/*
180180
* XXX -- the implementation of int2vector's in postgres is a hack, and will
181181
* go away someday. until that happens, there is a case (in the
@@ -213,8 +213,8 @@ DATA(insert OID = 29 ( cid PGUID 4 10 t b t \054 0 0 cidin cidout cidin
213213
DESCR("command identifier type, sequence in transaction id");
214214
#define CIDOID 29
215215

216-
DATA(insert OID = 30 ( oidvector PGUID 64 193 f b t \054 0 26 oidvectorin oidvectorout oidvectorin oidvectorout i _null_ ));
217-
DESCR("array of 16 oids, used in system tables");
216+
DATA(insert OID = 30 ( oidvector PGUID INDEX_MAX_KEYS*4 -1 f b t \054 0 26 oidvectorin oidvectorout oidvectorin oidvectorout i _null_ ));
217+
DESCR("array of INDEX_MAX_KEYS oids, used in system tables");
218218
DATA(insert OID = 32 ( SET PGUID -1 -1 f b t \054 0 0 textin textout textin textout i _null_ ));
219219
DESCR("set of tuples");
220220

0 commit comments

Comments
 (0)