Re: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers
От | Andres Freund |
---|---|
Тема | Re: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers |
Дата | |
Msg-id | 20140408084904.GR4161@awork2.anarazel.de обсуждение исходный текст |
Ответ на | Re: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers
|
Список | pgsql-hackers |
On 2014-04-07 21:47:38 -0400, Tom Lane wrote: > Andres Freund <andres@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
В списке pgsql-hackers по дате отправления: