typedef struct
{
DestReceiver pub; /* publicly-known function pointers */
- StringInfoData buf; /* output buffer */
Portal portal; /* the Portal we are printing from */
bool sendDescrip; /* send RowDescription at startup? */
TupleDesc attrinfo; /* The attr info we are set up for */
int nattrs;
PrinttupAttrInfo *myinfo; /* Cached info about each attr */
+ StringInfoData buf; /* output buffer (*not* in tmpcontext) */
MemoryContext tmpcontext; /* Memory context for per-row workspace */
} DR_printtup;
self->attrinfo = NULL;
self->nattrs = 0;
self->myinfo = NULL;
+ self->buf.data = NULL;
self->tmpcontext = NULL;
return (DestReceiver *) self;
DR_printtup *myState = (DR_printtup *) self;
Portal portal = myState->portal;
- /* create buffer to be used for all messages */
+ /*
+ * Create I/O buffer to be used for all messages. This cannot be inside
+ * tmpcontext, since we want to re-use it across rows.
+ */
initStringInfo(&myState->buf);
/*
myState->attrinfo = NULL;
+ if (myState->buf.data)
+ pfree(myState->buf.data);
+ myState->buf.data = NULL;
+
if (myState->tmpcontext)
MemoryContextDelete(myState->tmpcontext);
myState->tmpcontext = NULL;