8383#define VARLENA_ATT_IS_PACKABLE (att ) \
8484((att)->attstorage != TYPSTORAGE_PLAIN)
8585
86- /* FormData_pg_attribute.attstorage != TYPSTORAGE_PLAIN and an attlen of -1 */
87- #define COMPACT_ATTR_IS_PACKABLE (att ) \
88- ((att)->attlen == -1 && (att)->attispackable)
89-
9086/*
9187 * Setup for caching pass-by-ref missing attributes in a way that survives
9288 * tupleDesc destruction.
@@ -151,12 +147,12 @@ Datum
151147getmissingattr (TupleDesc tupleDesc ,
152148int attnum ,bool * isnull )
153149{
154- CompactAttribute * att ;
150+ Form_pg_attribute att ;
155151
156152Assert (attnum <=tupleDesc -> natts );
157153Assert (attnum > 0 );
158154
159- att = TupleDescCompactAttr (tupleDesc ,attnum - 1 );
155+ att = TupleDescAttr (tupleDesc ,attnum - 1 );
160156
161157if (att -> atthasmissing )
162158{
@@ -227,15 +223,15 @@ heap_compute_data_size(TupleDesc tupleDesc,
227223for (i = 0 ;i < numberOfAttributes ;i ++ )
228224{
229225Datum val ;
230- CompactAttribute * atti ;
226+ Form_pg_attribute atti ;
231227
232228if (isnull [i ])
233229continue ;
234230
235231val = values [i ];
236- atti = TupleDescCompactAttr (tupleDesc ,i );
232+ atti = TupleDescAttr (tupleDesc ,i );
237233
238- if (COMPACT_ATTR_IS_PACKABLE (atti )&&
234+ if (ATT_IS_PACKABLE (atti )&&
239235VARATT_CAN_MAKE_SHORT (DatumGetPointer (val )))
240236{
241237/*
@@ -272,7 +268,7 @@ heap_compute_data_size(TupleDesc tupleDesc,
272268 * Fill in either a data value or a bit in the null bitmask
273269 */
274270static inline void
275- fill_val (CompactAttribute * att ,
271+ fill_val (Form_pg_attribute att ,
276272bits8 * * bit ,
277273int * bitmask ,
278274char * * dataP ,
@@ -353,7 +349,8 @@ fill_val(CompactAttribute *att,
353349data_length = VARSIZE_SHORT (val );
354350memcpy (data ,val ,data_length );
355351}
356- else if (att -> attispackable && VARATT_CAN_MAKE_SHORT (val ))
352+ else if (VARLENA_ATT_IS_PACKABLE (att )&&
353+ VARATT_CAN_MAKE_SHORT (val ))
357354{
358355/* convert to short varlena -- no alignment */
359356data_length = VARATT_CONVERTED_SHORT_SIZE (val );
@@ -430,7 +427,7 @@ heap_fill_tuple(TupleDesc tupleDesc,
430427
431428for (i = 0 ;i < numberOfAttributes ;i ++ )
432429{
433- CompactAttribute * attr = TupleDescCompactAttr (tupleDesc ,i );
430+ Form_pg_attribute attr = TupleDescAttr (tupleDesc ,i );
434431
435432fill_val (attr ,
436433bitP ?& bitP :NULL ,
@@ -464,8 +461,7 @@ heap_attisnull(HeapTuple tup, int attnum, TupleDesc tupleDesc)
464461Assert (!tupleDesc || attnum <=tupleDesc -> natts );
465462if (attnum > (int )HeapTupleHeaderGetNatts (tup -> t_data ))
466463{
467- if (tupleDesc &&
468- TupleDescCompactAttr (tupleDesc ,attnum - 1 )-> atthasmissing )
464+ if (tupleDesc && TupleDescAttr (tupleDesc ,attnum - 1 )-> atthasmissing )
469465return false;
470466else
471467return true;
@@ -574,13 +570,13 @@ nocachegetattr(HeapTuple tup,
574570
575571if (!slow )
576572{
577- CompactAttribute * att ;
573+ Form_pg_attribute att ;
578574
579575/*
580576 * If we get here, there are no nulls up to and including the target
581577 * attribute. If we have a cached offset, we can use it.
582578 */
583- att = TupleDescCompactAttr (tupleDesc ,attnum );
579+ att = TupleDescAttr (tupleDesc ,attnum );
584580if (att -> attcacheoff >=0 )
585581return fetchatt (att ,tp + att -> attcacheoff );
586582
@@ -595,7 +591,7 @@ nocachegetattr(HeapTuple tup,
595591
596592for (j = 0 ;j <=attnum ;j ++ )
597593{
598- if (TupleDescCompactAttr (tupleDesc ,j )-> attlen <=0 )
594+ if (TupleDescAttr (tupleDesc ,j )-> attlen <=0 )
599595{
600596slow = true;
601597break ;
@@ -618,18 +614,18 @@ nocachegetattr(HeapTuple tup,
618614 * fixed-width columns, in hope of avoiding future visits to this
619615 * routine.
620616 */
621- TupleDescCompactAttr (tupleDesc ,0 )-> attcacheoff = 0 ;
617+ TupleDescAttr (tupleDesc ,0 )-> attcacheoff = 0 ;
622618
623619/* we might have set some offsets in the slow path previously */
624- while (j < natts && TupleDescCompactAttr (tupleDesc ,j )-> attcacheoff > 0 )
620+ while (j < natts && TupleDescAttr (tupleDesc ,j )-> attcacheoff > 0 )
625621j ++ ;
626622
627- off = TupleDescCompactAttr (tupleDesc ,j - 1 )-> attcacheoff +
628- TupleDescCompactAttr (tupleDesc ,j - 1 )-> attlen ;
623+ off = TupleDescAttr (tupleDesc ,j - 1 )-> attcacheoff +
624+ TupleDescAttr (tupleDesc ,j - 1 )-> attlen ;
629625
630626for (;j < natts ;j ++ )
631627{
632- CompactAttribute * att = TupleDescCompactAttr (tupleDesc ,j );
628+ Form_pg_attribute att = TupleDescAttr (tupleDesc ,j );
633629
634630if (att -> attlen <=0 )
635631break ;
@@ -643,7 +639,7 @@ nocachegetattr(HeapTuple tup,
643639
644640Assert (j > attnum );
645641
646- off = TupleDescCompactAttr (tupleDesc ,attnum )-> attcacheoff ;
642+ off = TupleDescAttr (tupleDesc ,attnum )-> attcacheoff ;
647643}
648644else
649645{
@@ -663,7 +659,7 @@ nocachegetattr(HeapTuple tup,
663659off = 0 ;
664660for (i = 0 ;;i ++ )/* loop exit is at "break" */
665661{
666- CompactAttribute * att = TupleDescCompactAttr (tupleDesc ,i );
662+ Form_pg_attribute att = TupleDescAttr (tupleDesc ,i );
667663
668664if (HeapTupleHasNulls (tup )&& att_isnull (i ,bp ))
669665{
@@ -711,7 +707,7 @@ nocachegetattr(HeapTuple tup,
711707}
712708}
713709
714- return fetchatt (TupleDescCompactAttr (tupleDesc ,attnum ),tp + off );
710+ return fetchatt (TupleDescAttr (tupleDesc ,attnum ),tp + off );
715711}
716712
717713/* ----------------
@@ -896,7 +892,7 @@ expand_tuple(HeapTuple *targetHeapTuple,
896892{
897893if (attrmiss [attnum ].am_present )
898894{
899- CompactAttribute * att = TupleDescCompactAttr (tupleDesc ,attnum );
895+ Form_pg_attribute att = TupleDescAttr (tupleDesc ,attnum );
900896
901897targetDataLen = att_align_datum (targetDataLen ,
902898att -> attalign ,
@@ -1024,7 +1020,8 @@ expand_tuple(HeapTuple *targetHeapTuple,
10241020/* Now fill in the missing values */
10251021for (attnum = sourceNatts ;attnum < natts ;attnum ++ )
10261022{
1027- CompactAttribute * attr = TupleDescCompactAttr (tupleDesc ,attnum );
1023+
1024+ Form_pg_attribute attr = TupleDescAttr (tupleDesc ,attnum );
10281025
10291026if (attrmiss && attrmiss [attnum ].am_present )
10301027{
@@ -1373,7 +1370,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
13731370
13741371for (attnum = 0 ;attnum < natts ;attnum ++ )
13751372{
1376- CompactAttribute * thisatt = TupleDescCompactAttr (tupleDesc ,attnum );
1373+ Form_pg_attribute thisatt = TupleDescAttr (tupleDesc ,attnum );
13771374
13781375if (hasnulls && att_isnull (attnum ,bp ))
13791376{