Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers
Date: 2014-04-07 19:28:15
Message-ID: 20140407192815.GL4161@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-04-07 19:35:09 Re: "Transaction local" statistics are incorrect at speed
Previous Message Tom Lane 2014-04-07 19:22:33 "Transaction local" statistics are incorrect at speed