mirror of
https://github.com/postgres/postgres.git
synced 2025-06-30 21:42:05 +03:00
Enable another five tuple status bits by using the high bits of the
nattr field, and rename the field. Heikki Linnakangas
This commit is contained in:
@ -16,7 +16,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.113 2007/01/05 22:19:21 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.114 2007/01/09 22:00:59 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -295,7 +295,7 @@ DataFill(char *data,
|
||||
bool
|
||||
heap_attisnull(HeapTuple tup, int attnum)
|
||||
{
|
||||
if (attnum > (int) tup->t_data->t_natts)
|
||||
if (attnum > (int) HeapTupleHeaderGetNatts(tup->t_data))
|
||||
return true;
|
||||
|
||||
if (attnum > 0)
|
||||
@ -474,6 +474,7 @@ nocachegetattr(HeapTuple tuple,
|
||||
{
|
||||
int j = 1;
|
||||
long off;
|
||||
int natts = HeapTupleHeaderGetNatts(tup);
|
||||
|
||||
/*
|
||||
* need to set cache for some atts
|
||||
@ -488,7 +489,7 @@ nocachegetattr(HeapTuple tuple,
|
||||
|
||||
for (; j <= attnum ||
|
||||
/* Can we compute more? We will probably need them */
|
||||
(j < tup->t_natts &&
|
||||
(j < natts &&
|
||||
att[j]->attcacheoff == -1 &&
|
||||
(HeapTupleNoNulls(tuple) || !att_isnull(j, bp)) &&
|
||||
(HeapTupleAllFixed(tuple) || att[j]->attlen > 0)); j++)
|
||||
@ -739,7 +740,7 @@ heap_form_tuple(TupleDesc tupleDescriptor,
|
||||
HeapTupleHeaderSetTypeId(td, tupleDescriptor->tdtypeid);
|
||||
HeapTupleHeaderSetTypMod(td, tupleDescriptor->tdtypmod);
|
||||
|
||||
td->t_natts = numberOfAttributes;
|
||||
HeapTupleHeaderSetNatts(td, numberOfAttributes);
|
||||
td->t_hoff = hoff;
|
||||
|
||||
if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */
|
||||
@ -846,7 +847,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
|
||||
HeapTupleHeaderSetTypeId(td, tupleDescriptor->tdtypeid);
|
||||
HeapTupleHeaderSetTypMod(td, tupleDescriptor->tdtypmod);
|
||||
|
||||
td->t_natts = numberOfAttributes;
|
||||
HeapTupleHeaderSetNatts(td, numberOfAttributes);
|
||||
td->t_hoff = hoff;
|
||||
|
||||
if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */
|
||||
@ -1035,7 +1036,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
|
||||
bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
|
||||
bool slow = false; /* can we use/set attcacheoff? */
|
||||
|
||||
natts = tup->t_natts;
|
||||
natts = HeapTupleHeaderGetNatts(tup);
|
||||
|
||||
/*
|
||||
* In inheritance situations, it is possible that the given tuple actually
|
||||
@ -1128,7 +1129,7 @@ heap_deformtuple(HeapTuple tuple,
|
||||
bits8 *bp = tup->t_bits; /* ptr to null bitmap in tuple */
|
||||
bool slow = false; /* can we use/set attcacheoff? */
|
||||
|
||||
natts = tup->t_natts;
|
||||
natts = HeapTupleHeaderGetNatts(tup);
|
||||
|
||||
/*
|
||||
* In inheritance situations, it is possible that the given tuple actually
|
||||
@ -1335,7 +1336,7 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
|
||||
* than the tupdesc.)
|
||||
*/
|
||||
tup = tuple->t_data;
|
||||
if (attnum > tup->t_natts)
|
||||
if (attnum > HeapTupleHeaderGetNatts(tup))
|
||||
{
|
||||
*isnull = true;
|
||||
return (Datum) 0;
|
||||
@ -1401,7 +1402,7 @@ slot_getallattrs(TupleTableSlot *slot)
|
||||
/*
|
||||
* load up any slots available from physical tuple
|
||||
*/
|
||||
attnum = tuple->t_data->t_natts;
|
||||
attnum = HeapTupleHeaderGetNatts(tuple->t_data);
|
||||
attnum = Min(attnum, tdesc_natts);
|
||||
|
||||
slot_deform_tuple(slot, attnum);
|
||||
@ -1448,7 +1449,7 @@ slot_getsomeattrs(TupleTableSlot *slot, int attnum)
|
||||
/*
|
||||
* load up any slots available from physical tuple
|
||||
*/
|
||||
attno = tuple->t_data->t_natts;
|
||||
attno = HeapTupleHeaderGetNatts(tuple->t_data);
|
||||
attno = Min(attno, attnum);
|
||||
|
||||
slot_deform_tuple(slot, attno);
|
||||
@ -1601,7 +1602,7 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor,
|
||||
* And fill in the information.
|
||||
*/
|
||||
tuple->t_len = len;
|
||||
tuple->t_natts = numberOfAttributes;
|
||||
HeapTupleHeaderSetNatts(tuple, numberOfAttributes);
|
||||
tuple->t_hoff = hoff + MINIMAL_TUPLE_OFFSET;
|
||||
|
||||
if (tupleDescriptor->tdhasoid) /* else leave infomask = 0 */
|
||||
@ -1663,7 +1664,7 @@ heap_tuple_from_minimal_tuple(MinimalTuple mtup)
|
||||
result->t_tableOid = InvalidOid;
|
||||
result->t_data = (HeapTupleHeader) ((char *) result + HEAPTUPLESIZE);
|
||||
memcpy((char *) result->t_data + MINIMAL_TUPLE_OFFSET, mtup, mtup->t_len);
|
||||
memset(result->t_data, 0, offsetof(HeapTupleHeaderData, t_natts));
|
||||
memset(result->t_data, 0, offsetof(HeapTupleHeaderData, t_infomask2));
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1729,7 +1730,7 @@ heap_addheader(int natts, /* max domain index */
|
||||
|
||||
/* we don't bother to fill the Datum fields */
|
||||
|
||||
td->t_natts = natts;
|
||||
HeapTupleHeaderSetNatts(td, natts);
|
||||
td->t_hoff = hoff;
|
||||
|
||||
if (withoid) /* else leave infomask = 0 */
|
||||
|
Reference in New Issue
Block a user