aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/common/indextuple.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-09-23 22:40:12 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-09-23 22:40:12 +0000
commitacbbeffc29b5366e1bf1955a9cfad1305e9e23bb (patch)
tree670f3bdbf746bcc4e726270e5115249b6a4f8da6 /src/backend/access/common/indextuple.c
parent33e5a4dfa528e1557dd9b2c2359449632fe1d343 (diff)
downloadpostgresql-acbbeffc29b5366e1bf1955a9cfad1305e9e23bb.tar.gz
postgresql-acbbeffc29b5366e1bf1955a9cfad1305e9e23bb.zip
Clean up some ugly coding (hardwired constants) in index_formtuple.
Diffstat (limited to 'src/backend/access/common/indextuple.c')
-rw-r--r--src/backend/access/common/indextuple.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/backend/access/common/indextuple.c b/src/backend/access/common/indextuple.c
index 9450911ab15..b4dc69df269 100644
--- a/src/backend/access/common/indextuple.c
+++ b/src/backend/access/common/indextuple.c
@@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.44 2000/07/22 11:18:45 wieck Exp $
+ * $Header: /cvsroot/pgsql/src/backend/access/common/indextuple.c,v 1.45 2000/09/23 22:40:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -46,8 +46,8 @@ index_formtuple(TupleDesc tupleDescriptor,
uint16 tupmask = 0;
int numberOfAttributes = tupleDescriptor->natts;
#ifdef TOAST_INDEX_HACK
- Datum untoasted_value[MaxHeapAttributeNumber];
- bool untoasted_free[MaxHeapAttributeNumber];
+ Datum untoasted_value[INDEX_MAX_KEYS];
+ bool untoasted_free[INDEX_MAX_KEYS];
#endif
if (numberOfAttributes > INDEX_MAX_KEYS)
@@ -79,10 +79,14 @@ index_formtuple(TupleDesc tupleDescriptor,
}
}
#endif
- for (i = 0; i < numberOfAttributes && !hasnull; i++)
+
+ for (i = 0; i < numberOfAttributes; i++)
{
if (null[i] != ' ')
+ {
hasnull = true;
+ break;
+ }
}
if (hasnull)
@@ -122,23 +126,21 @@ index_formtuple(TupleDesc tupleDescriptor,
/*
* We do this because DataFill wants to initialize a "tupmask" which
* is used for HeapTuples, but we want an indextuple infomask. The
- * only "relevent" info is the "has variable attributes" field, which
- * is in mask position 0x02. We have already set the null mask above.
+ * only relevant info is the "has variable attributes" field.
+ * We have already set the hasnull bit above.
*/
- if (tupmask & 0x02)
+ if (tupmask & HEAP_HASVARLENA)
infomask |= INDEX_VAR_MASK;
/*
- * Here we make sure that we can actually hold the size. We also want
- * to make sure that size is not aligned oddly. This actually is a
- * rather odd way to make sure the size is not too large overall.
+ * Here we make sure that the size will fit in the field reserved for
+ * it in t_info.
*/
- if (size & 0xE000)
+ if ((size & INDEX_SIZE_MASK) != size)
elog(ERROR, "index_formtuple: data takes %d bytes: too big", size);
-
infomask |= size;
/* ----------------