On 2014-04-07 21:47:38 -0400, Tom Lane wrote:
> Andres Freund <and...@2ndquadrant.com> writes:
> > So what I now do is essentially:
> > while ((scantuple = index_getnext(scan, ForwardScanDirection)) != NULL)
> > {
> > ...
> >         ht = palloc(sizeof(HeapTupleData)); /* in the right context */
> >         memcpy(ht, scantuple, sizeof(HeapTupleData));
> >         ExecStoreTuple(ht, slot, scan->xs_cbuf, false);
> >         slot->tts_shouldFree = true;
> > ...
> > }
> 
> Well, that is certainly messy.  I think you could just use a local
> HeapTupleData variable instead of palloc'ing every time, where "local"
> means "has lifespan similar to the slot pointer".

Doesn't work nicely in this specific situation, but it's obviously an
alternative.

> There's some vaguely similar hacking near the end of ExecDelete.

Yea, and some other places. I wonder if a ExecShallowMaterializeSlot()
or something would be useful for me, that callsite and others?

Greetings,

Andres Freund

-- 
 Andres Freund                     http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to