diff --git a/src/backend/cdb/motion/tupser.c b/src/backend/cdb/motion/tupser.c index 577105255130eff1876bb8ef9cd5252c7a530afe..eaafd5d8b424e2b04165e7a7fc204871bcfc5f68 100644 --- a/src/backend/cdb/motion/tupser.c +++ b/src/backend/cdb/motion/tupser.c @@ -16,7 +16,6 @@ #include "postgres.h" #include "access/htup.h" -#include "access/tuptoaster.h" #include "catalog/pg_type.h" #include "cdb/cdbmotion.h" #include "cdb/cdbsrlz.h" @@ -656,17 +655,9 @@ SerializeTuple(TupleTableSlot *slot, SerTupInfo *pSerInfo, struct directTranspor * avoid memory leakage: we want to force the detoast * allocation(s) to happen in our reset-able serialization * context. - * - * Only detoast, don't decompress. It saves network bandwidth - * to let the receiver decompress it. Furthermore, it's possible - * that the receiver doesn't need to decompress it at all, which - * can be a very big win. */ oldCtxt = MemoryContextSwitchTo(s_tupSerMemCtxt); - if (VARATT_IS_EXTERNAL(origattr)) - attr = PointerGetDatum(heap_tuple_fetch_attr((struct varlena *) DatumGetPointer(origattr))); - else - attr = origattr; + attr = PointerGetDatum(PG_DETOAST_DATUM_PACKED(origattr)); MemoryContextSwitchTo(oldCtxt); sz = VARSIZE_ANY_EXHDR(attr);