simplify slot_deform_datarow by using VARSIZE_ANY
authorTomas Vondra <[email protected]>
Tue, 23 Aug 2016 08:45:16 +0000 (10:45 +0200)
committerPavan Deolasee <[email protected]>
Thu, 25 Aug 2016 04:44:47 +0000 (10:14 +0530)
Replace the slightly complex branching with VARSIZE_ANY, which does
exactly the same thing. Also, ditch the pointless '#ifdef PGXC'
around the function.

src/backend/access/common/heaptuple.c

index ffc48bd8b129f26ac934f8d15b4d6fd432b1f20a..49560f2a8ba509917d8c47a2052b1e148bd51f94 100644 (file)
@@ -1198,7 +1198,6 @@ slot_deform_tuple(TupleTableSlot *slot, int natts)
        slot->tts_slow = slow;
 }
 
-#ifdef PGXC
 /*
  * slot_deform_datarow
  *             Extract data from the DataRow message into Datum/isnull arrays.
@@ -1304,14 +1303,7 @@ slot_deform_datarow(TupleTableSlot *slot)
                                if (attr->attlen == -1)
                                {
                                        /* varlena */
-                                       if (VARATT_IS_EXTERNAL(val))
-                                               /* no alignment, since it's short by definition */
-                                               data_length = VARSIZE_EXTERNAL(val);
-                                       else if (VARATT_IS_SHORT(val))
-                                               /* no alignment for short varlenas */
-                                               data_length = VARSIZE_SHORT(val);
-                                       else
-                                               data_length = VARSIZE(val);
+                                       data_length = VARSIZE_ANY(val);
                                }
                                else if (attr->attlen == -2)
                                {
@@ -1338,7 +1330,6 @@ slot_deform_datarow(TupleTableSlot *slot)
        slot->tts_nvalid = attnum;
 
 }
-#endif
 
 /*
  * slot_getattr