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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andres Freund <andres(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers
Date: 2014-04-08 13:37:33
Message-ID: 23133.1396964253@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Andres Freund <andres(at)2ndquadrant(dot)com> writes:
> On 2014-04-07 21:47:38 -0400, Tom Lane wrote:
>> 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".

>> 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?

Don't like that name much, but I agree there's some room for a function
like this. I guess you're imagining that we'd add a HeapTupleData field
to TupleTableSlots, and use that for the workspace when this situation
arises?

An alternative possibility would be to not invent a new function, but
just make ExecStoreTuple do this unconditionally when shouldFree=false.
Not sure if there'd be a noticeable runtime penalty --- but the
existing approach seems rather fragile. I know I've always thought
of slots as being fully independent storage, and in this case they
are not.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2014-04-08 13:48:57 Re: Why is it not sane to pass ExecStoreTuple(shouldFree=true) for tuples point into buffers
Previous Message Heikki Linnakangas 2014-04-08 10:12:08 Re: B-Tree support function number 3 (strxfrm() optimization)