Re: Tuplestore should remember the memory context it's created in - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Tuplestore should remember the memory context it's created in
Date
Msg-id 1145.1261514858@sss.pgh.pa.us
Whole thread Raw
In response to Re: Tuplestore should remember the memory context it's created in  (Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>)
Responses Re: Tuplestore should remember the memory context it's created in
List pgsql-hackers
Heikki Linnakangas <heikki.linnakangas@enterprisedb.com> writes:
> Tom Lane wrote:
>> Got it.  So doesn't tuplesort have the same issue?

> Tuplesort has the same general problem that the caller of puttuple needs
> to be in the right resource owner. Which ought to be fixed, especially
> since tuplesort doesn't require that for the memory context anymore.

> But we don't use tuplesort to return tuples from functions, so it's not
> broken in a user-visible way. Unless you can think of another scenario
> like that.

(1) create a cursor whose plan involves a sort that will spill to disk
(2) enter subtransaction
(3) fetch from cursor (causing the sort to actually happen)
(4) leave subtransaction
(5) fetch some more from cursor

Too busy to develop a test case right now, but ISTM it ought to fail.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: LIKE INCLUDING COMMENTS code is a flight of fancy
Next
From: Tom Lane
Date:
Subject: Re: Possible patch for better index name choosing