On Thu, Sep 29, 2016 at 4:40 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> My immediate reaction to this is WTF. It seems like you have completely
> broken the expected contract of tuplesort_gettupleslot, which is that
> it copies the data into caller-owned memory. That cannot stand.
Other comparable routines, like tuplesort_getindextuple(), could be
argued to have always had a contract that allows for this kind of
thing (recycling batch memory) because they get to examine a
*should_free pointer -- do you accept that much?
tuplesort_gettupleslot() does that for callers that happen to want to
use a tuple slot, rather than a direct caller tuple. So, it doesn't
seem like there is a very hard distinction there; that could also have
broken something in an extension too, since the lifetime of memory
controlled by tuplesort (should_free = false cases, managed by
tuplesort memory context) was always a bit unclear.
--
Peter Geoghegan