|
9 | 9 | *
|
10 | 10 | *
|
11 | 11 | * IDENTIFICATION
|
12 |
| - * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.44 2000/07/22 11:18:45 wieck Exp $ |
| 12 | + * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.45 2000/09/23 22:40:12 tgl Exp $ |
13 | 13 | *
|
14 | 14 | *-------------------------------------------------------------------------
|
15 | 15 | */
|
@@ -46,8 +46,8 @@ index_formtuple(TupleDesc tupleDescriptor,
|
46 | 46 | uint16 tupmask = 0;
|
47 | 47 | int numberOfAttributes = tupleDescriptor->natts;
|
48 | 48 | #ifdef TOAST_INDEX_HACK
|
49 |
| - Datum untoasted_value[MaxHeapAttributeNumber]; |
50 |
| - bool untoasted_free[MaxHeapAttributeNumber]; |
| 49 | + Datum untoasted_value[INDEX_MAX_KEYS]; |
| 50 | + bool untoasted_free[INDEX_MAX_KEYS]; |
51 | 51 | #endif
|
52 | 52 |
|
53 | 53 | if (numberOfAttributes > INDEX_MAX_KEYS)
|
@@ -79,10 +79,14 @@ index_formtuple(TupleDesc tupleDescriptor,
|
79 | 79 | }
|
80 | 80 | }
|
81 | 81 | #endif
|
82 |
| - for (i = 0; i < numberOfAttributes && !hasnull; i++) |
| 82 | + |
| 83 | + for (i = 0; i < numberOfAttributes; i++) |
83 | 84 | {
|
84 | 85 | if (null[i] != ' ')
|
| 86 | + { |
85 | 87 | hasnull = true;
|
| 88 | + break; |
| 89 | + } |
86 | 90 | }
|
87 | 91 |
|
88 | 92 | if (hasnull)
|
@@ -122,23 +126,21 @@ index_formtuple(TupleDesc tupleDescriptor,
|
122 | 126 | /*
|
123 | 127 | * We do this because DataFill wants to initialize a "tupmask" which
|
124 | 128 | * is used for HeapTuples, but we want an indextuple infomask. The
|
125 |
| - * only "relevent" info is the "has variable attributes" field, which |
126 |
| - * is in mask position 0x02. We have already set the null mask above. |
| 129 | + * only relevant info is the "has variable attributes" field. |
| 130 | + * We have already set the hasnull bit above. |
127 | 131 | */
|
128 | 132 |
|
129 |
| - if (tupmask & 0x02) |
| 133 | + if (tupmask & HEAP_HASVARLENA) |
130 | 134 | infomask |= INDEX_VAR_MASK;
|
131 | 135 |
|
132 | 136 | /*
|
133 |
| - * Here we make sure that we can actually hold the size. We also want |
134 |
| - * to make sure that size is not aligned oddly. This actually is a |
135 |
| - * rather odd way to make sure the size is not too large overall. |
| 137 | + * Here we make sure that the size will fit in the field reserved for |
| 138 | + * it in t_info. |
136 | 139 | */
|
137 | 140 |
|
138 |
| - if (size & 0xE000) |
| 141 | + if ((size & INDEX_SIZE_MASK) != size) |
139 | 142 | elog(ERROR, "index_formtuple: data takes %d bytes: too big", size);
|
140 | 143 |
|
141 |
| - |
142 | 144 | infomask |= size;
|
143 | 145 |
|
144 | 146 | /* ----------------
|
|
0 commit comments