*** pgsql/src/backend/access/common/printtup.c 2008/04/17 21:37:28 1.102 --- pgsql/src/backend/access/common/printtup.c 2008/11/30 20:51:24 1.103 *************** *** 9,15 **** * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.101 2008/01/01 19:45:45 momjian Exp $ * *------------------------------------------------------------------------- */ --- 9,15 ---- * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.102 2008/04/17 21:37:28 alvherre Exp $ * *------------------------------------------------------------------------- */ *************** typedef struct *** 67,97 **** * ---------------- */ DestReceiver * ! printtup_create_DR(CommandDest dest, Portal portal) { ! DR_printtup *self = (DR_printtup *) palloc(sizeof(DR_printtup)); ! if (PG_PROTOCOL_MAJOR(FrontendProtocol) >= 3) ! self->pub.receiveSlot = printtup; ! else ! { ! /* ! * In protocol 2.0 the Bind message does not exist, so there is no way ! * for the columns to have different print formats; it's sufficient to ! * look at the first one. ! */ ! if (portal->formats && portal->formats[0] != 0) ! self->pub.receiveSlot = printtup_internal_20; ! else ! self->pub.receiveSlot = printtup_20; ! } self->pub.rStartup = printtup_startup; self->pub.rShutdown = printtup_shutdown; self->pub.rDestroy = printtup_destroy; self->pub.mydest = dest; - self->portal = portal; - /* * Send T message automatically if DestRemote, but not if * DestRemoteExecute --- 67,82 ---- * ---------------- */ DestReceiver * ! printtup_create_DR(CommandDest dest) { ! DR_printtup *self = (DR_printtup *) palloc0(sizeof(DR_printtup)); ! self->pub.receiveSlot = printtup; /* might get changed later */ self->pub.rStartup = printtup_startup; self->pub.rShutdown = printtup_shutdown; self->pub.rDestroy = printtup_destroy; self->pub.mydest = dest; /* * Send T message automatically if DestRemote, but not if * DestRemoteExecute *************** printtup_create_DR(CommandDest dest, Por *** 105,110 **** --- 90,122 ---- return (DestReceiver *) self; } + /* + * Set parameters for a DestRemote (or DestRemoteExecute) receiver + */ + void + SetRemoteDestReceiverParams(DestReceiver *self, Portal portal) + { + DR_printtup *myState = (DR_printtup *) self; + + Assert(myState->pub.mydest == DestRemote || + myState->pub.mydest == DestRemoteExecute); + + myState->portal = portal; + + if (PG_PROTOCOL_MAJOR(FrontendProtocol) < 3) + { + /* + * In protocol 2.0 the Bind message does not exist, so there is no way + * for the columns to have different print formats; it's sufficient to + * look at the first one. + */ + if (portal->formats && portal->formats[0] != 0) + myState->pub.receiveSlot = printtup_internal_20; + else + myState->pub.receiveSlot = printtup_20; + } + } + static void printtup_startup(DestReceiver *self, int operation, TupleDesc typeinfo) {