16
16
*
17
17
*
18
18
* IDENTIFICATION
19
- * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.113 2007/01/05 22:19:21 momjian Exp $
19
+ * $PostgreSQL: pgsql/src/backend/access/common/heaptuple.c,v 1.114 2007/01/09 22:00:59 momjian Exp $
20
20
*
21
21
*-------------------------------------------------------------------------
22
22
*/
@@ -295,7 +295,7 @@ DataFill(char *data,
295
295
bool
296
296
heap_attisnull (HeapTuple tup ,int attnum )
297
297
{
298
- if (attnum > (int )tup -> t_data -> t_natts )
298
+ if (attnum > (int )HeapTupleHeaderGetNatts ( tup -> t_data ) )
299
299
return true;
300
300
301
301
if (attnum > 0 )
@@ -474,6 +474,7 @@ nocachegetattr(HeapTuple tuple,
474
474
{
475
475
int j = 1 ;
476
476
long off ;
477
+ int natts = HeapTupleHeaderGetNatts (tup );
477
478
478
479
/*
479
480
* need to set cache for some atts
@@ -488,7 +489,7 @@ nocachegetattr(HeapTuple tuple,
488
489
489
490
for (;j <=attnum ||
490
491
/* Can we compute more? We will probably need them */
491
- (j < tup -> t_natts &&
492
+ (j < natts &&
492
493
att [j ]-> attcacheoff == -1 &&
493
494
(HeapTupleNoNulls (tuple )|| !att_isnull (j ,bp ))&&
494
495
(HeapTupleAllFixed (tuple )|| att [j ]-> attlen > 0 ));j ++ )
@@ -739,7 +740,7 @@ heap_form_tuple(TupleDesc tupleDescriptor,
739
740
HeapTupleHeaderSetTypeId (td ,tupleDescriptor -> tdtypeid );
740
741
HeapTupleHeaderSetTypMod (td ,tupleDescriptor -> tdtypmod );
741
742
742
- td -> t_natts = numberOfAttributes ;
743
+ HeapTupleHeaderSetNatts ( td , numberOfAttributes ) ;
743
744
td -> t_hoff = hoff ;
744
745
745
746
if (tupleDescriptor -> tdhasoid )/* else leave infomask = 0 */
@@ -846,7 +847,7 @@ heap_formtuple(TupleDesc tupleDescriptor,
846
847
HeapTupleHeaderSetTypeId (td ,tupleDescriptor -> tdtypeid );
847
848
HeapTupleHeaderSetTypMod (td ,tupleDescriptor -> tdtypmod );
848
849
849
- td -> t_natts = numberOfAttributes ;
850
+ HeapTupleHeaderSetNatts ( td , numberOfAttributes ) ;
850
851
td -> t_hoff = hoff ;
851
852
852
853
if (tupleDescriptor -> tdhasoid )/* else leave infomask = 0 */
@@ -1035,7 +1036,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
1035
1036
bits8 * bp = tup -> t_bits ;/* ptr to null bitmap in tuple */
1036
1037
bool slow = false;/* can we use/set attcacheoff? */
1037
1038
1038
- natts = tup -> t_natts ;
1039
+ natts = HeapTupleHeaderGetNatts ( tup ) ;
1039
1040
1040
1041
/*
1041
1042
* In inheritance situations, it is possible that the given tuple actually
@@ -1128,7 +1129,7 @@ heap_deformtuple(HeapTuple tuple,
1128
1129
bits8 * bp = tup -> t_bits ;/* ptr to null bitmap in tuple */
1129
1130
bool slow = false;/* can we use/set attcacheoff? */
1130
1131
1131
- natts = tup -> t_natts ;
1132
+ natts = HeapTupleHeaderGetNatts ( tup ) ;
1132
1133
1133
1134
/*
1134
1135
* In inheritance situations, it is possible that the given tuple actually
@@ -1335,7 +1336,7 @@ slot_getattr(TupleTableSlot *slot, int attnum, bool *isnull)
1335
1336
* than the tupdesc.)
1336
1337
*/
1337
1338
tup = tuple -> t_data ;
1338
- if (attnum > tup -> t_natts )
1339
+ if (attnum > HeapTupleHeaderGetNatts ( tup ) )
1339
1340
{
1340
1341
* isnull = true;
1341
1342
return (Datum )0 ;
@@ -1401,7 +1402,7 @@ slot_getallattrs(TupleTableSlot *slot)
1401
1402
/*
1402
1403
* load up any slots available from physical tuple
1403
1404
*/
1404
- attnum = tuple -> t_data -> t_natts ;
1405
+ attnum = HeapTupleHeaderGetNatts ( tuple -> t_data ) ;
1405
1406
attnum = Min (attnum ,tdesc_natts );
1406
1407
1407
1408
slot_deform_tuple (slot ,attnum );
@@ -1448,7 +1449,7 @@ slot_getsomeattrs(TupleTableSlot *slot, int attnum)
1448
1449
/*
1449
1450
* load up any slots available from physical tuple
1450
1451
*/
1451
- attno = tuple -> t_data -> t_natts ;
1452
+ attno = HeapTupleHeaderGetNatts ( tuple -> t_data ) ;
1452
1453
attno = Min (attno ,attnum );
1453
1454
1454
1455
slot_deform_tuple (slot ,attno );
@@ -1601,7 +1602,7 @@ heap_form_minimal_tuple(TupleDesc tupleDescriptor,
1601
1602
* And fill in the information.
1602
1603
*/
1603
1604
tuple -> t_len = len ;
1604
- tuple -> t_natts = numberOfAttributes ;
1605
+ HeapTupleHeaderSetNatts ( tuple , numberOfAttributes ) ;
1605
1606
tuple -> t_hoff = hoff + MINIMAL_TUPLE_OFFSET ;
1606
1607
1607
1608
if (tupleDescriptor -> tdhasoid )/* else leave infomask = 0 */
@@ -1663,7 +1664,7 @@ heap_tuple_from_minimal_tuple(MinimalTuple mtup)
1663
1664
result -> t_tableOid = InvalidOid ;
1664
1665
result -> t_data = (HeapTupleHeader ) ((char * )result + HEAPTUPLESIZE );
1665
1666
memcpy ((char * )result -> t_data + MINIMAL_TUPLE_OFFSET ,mtup ,mtup -> t_len );
1666
- memset (result -> t_data ,0 , offsetof(HeapTupleHeaderData ,t_natts ));
1667
+ memset (result -> t_data ,0 , offsetof(HeapTupleHeaderData ,t_infomask2 ));
1667
1668
return result ;
1668
1669
}
1669
1670
@@ -1729,7 +1730,7 @@ heap_addheader(int natts,/* max domain index */
1729
1730
1730
1731
/* we don't bother to fill the Datum fields */
1731
1732
1732
- td -> t_natts = natts ;
1733
+ HeapTupleHeaderSetNatts ( td , natts ) ;
1733
1734
td -> t_hoff = hoff ;
1734
1735
1735
1736
if (withoid )/* else leave infomask = 0 */