StringInfoData buf;
int natts = typeinfo->natts;
int i;
+ bool binary = false;
+
+ /* Set or update my derived attribute info, if needed */
+ if (myState->attrinfo != typeinfo || myState->nattrs != natts)
+ printtup_prepare_info(myState, typeinfo, natts);
#ifdef PGXC
+ /*
+ * The datanodes would have sent all attributes in TEXT form. But
+ * if the client has asked for any attribute to be sent in a binary format,
+ * then we must decode the datarow and send every attribute in the format
+ * that the client has asked for. Otherwise its ok to just forward the
+ * datarow as it is
+ */
+ for (i = 0; i < natts; ++i)
+ {
+ PrinttupAttrInfo *thisState = myState->myinfo + i;
+ if (thisState->format != 0)
+ binary = true;
+ }
/*
* If we are having DataRow-based tuple we do not have to encode attribute
* values, just send over the DataRow message as we received it from the
* Datanode
*/
- if (slot->tts_datarow)
+ if (slot->tts_datarow && !binary)
{
pq_putmessage('D', slot->tts_datarow->msg, slot->tts_datarow->msglen);
return;
}
#endif
- /* Set or update my derived attribute info, if needed */
- if (myState->attrinfo != typeinfo || myState->nattrs != natts)
- printtup_prepare_info(myState, typeinfo, natts);
/* Make sure the tuple is fully deconstructed */
slot_getallattrs(slot);