Re: memory context for tuplesort return values - Mailing list pgsql-hackers

From Tom Lane
Subject Re: memory context for tuplesort return values
Date
Msg-id 26370.1140732101@sss.pgh.pa.us
Whole thread Raw
In response to Re: memory context for tuplesort return values  (Alvaro Herrera <alvherre@commandprompt.com>)
Responses Re: memory context for tuplesort return values
List pgsql-hackers
Alvaro Herrera <alvherre@commandprompt.com> writes:
> Crazy ideas: add a #warning or #error to the header file unless there is
> some special symbol previously defined, something like
> #define I_UNDERSTAND_MEM_ALLOC_IN_TUPLETABLESLOT
> which means the developer did update his code.

Well, if we wanted to go that far, the simple solution is to rename
tuplesort_gettuple to something else.  Guaranteed code breakage then.
However, I think this is overkill for a problem that only *might*
bite people.  I kinda doubt that people are using TupleTableSlots in
add-on code, because the design of the executor makes it hard for
anything except plan nodes to obtain slots.  You'd have to posit a
piece of code that isn't structured as
while ((tuple = tuplesort_gettuple(...)) != NULL){    process tuple;    if (should_free)        pfree(tuple);}

but instead hangs onto the last tuple past the sort shutdown, and
yet isn't a plan node.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: memory context for tuplesort return values
Next
From: Alvaro Herrera
Date:
Subject: Re: memory context for tuplesort return values