Use platform independent type for TupleTableSlot->tts_off.
authorAndres Freund <andres@anarazel.de>
Tue, 20 Feb 2018 23:12:52 +0000 (15:12 -0800)
committerAndres Freund <andres@anarazel.de>
Tue, 20 Feb 2018 23:12:52 +0000 (15:12 -0800)
Previously tts_off was, for unknown reasons, of type long. For one
that's unnecessary as tuples are restricted in length, for another
long would be a bad choice of type even if that weren't the case, as
it's not reliably wider than an int. Also HeapTupleHeader->t_len is a
uint32.

This is split off from a larger patch implementing JITed tuple
deforming. Seems like an independent improvement, as tiny as it is.

Author: Andres Freund

src/backend/access/common/heaptuple.c
src/include/executor/tuptable.h

index 0a13251067ff8f163f3d9df9108342dd68fdf53d..a2f67f2332c2808bff2afbcc0fb3b5ad62f9b1fc 100644 (file)
@@ -942,7 +942,7 @@ heap_deform_tuple(HeapTuple tuple, TupleDesc tupleDesc,
    int         natts;          /* number of atts to extract */
    int         attnum;
    char       *tp;             /* ptr to tuple data */
-   long        off;            /* offset in tuple data */
+   uint32      off;            /* offset in tuple data */
    bits8      *bp = tup->t_bits;   /* ptr to null bitmap in tuple */
    bool        slow = false;   /* can we use/set attcacheoff? */
 
@@ -1043,7 +1043,7 @@ slot_deform_tuple(TupleTableSlot *slot, int natts)
    bool        hasnulls = HeapTupleHasNulls(tuple);
    int         attnum;
    char       *tp;             /* ptr to tuple data */
-   long        off;            /* offset in tuple data */
+   uint32      off;            /* offset in tuple data */
    bits8      *bp = tup->t_bits;   /* ptr to null bitmap in tuple */
    bool        slow;           /* can we use/set attcacheoff? */
 
index 8be0d5edc29ec1e61121e5dd15e91d1ac640c085..0642a3ada5e9670570235da0bc1ce7c0c5c4ce81 100644 (file)
@@ -126,7 +126,7 @@ typedef struct TupleTableSlot
    bool       *tts_isnull;     /* current per-attribute isnull flags */
    MinimalTuple tts_mintuple;  /* minimal tuple, or NULL if none */
    HeapTupleData tts_minhdr;   /* workspace for minimal-tuple-only case */
-   long        tts_off;        /* saved state for slot_deform_tuple */
+   uint32      tts_off;        /* saved state for slot_deform_tuple */
    bool        tts_fixedTupleDescriptor; /* descriptor can't be changed */
 } TupleTableSlot;