Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers - Mailing list pgsql-hackers

From Andres Freund
Subject Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers
Date
Msg-id 20140407192815.GL4161@awork2.anarazel.de
Whole thread Raw
Responses Re: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hi,

I've the need to persist a the result of an index_getnext() in a tuple
slot. I don't want to unneccessarily duplicate the tuple data itself, so
I'd like to use ExecStoreTuple(buffer = real_buffer) notion. But since
the next index_getnext()/index_endscan() will overwrite/release the
heaptuple I need to copy the HeapTupleData().
It'd be rather useful to be able to do ExecStoreTuple(tuple, slot,
some_buffer, true), i.e. hav ethe HeapTupleData struct freed *and* the
buffer pinned. There's an Assert preventing that though.

Why?

Greetings,

Andres Freund

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



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: "Transaction local" statistics are incorrect at speed
Next
From: Stephen Frost
Date:
Subject: Re: "Transaction local" statistics are incorrect at speed