Re: Tuplestore should remember the memory context it's created in

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Tuplestore should remember the memory context it's created in
Date: 2009-12-22 18:57:00
Message-ID: 22483.1261508220@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com> writes:
> Tom Lane wrote:
>> BTW, I'm not convinced that the owner-switchery you added to pl_exec.c
>> is necessary/appropriate. Under what circumstances would that be a good
>> idea?

> A PL/pgSQL normally runs in the whatever resource owner is current when
> the function is called. When we allocate the tuplestore for return
> tuples, it's associated with the current resource owner.

> But if you have an exception-block, we start a new subtransaction and
> switch to the subtransaction resource owner. If you have a RETURN
> NEXT/QUERY in the block, the tuplestore (or the temporary file backing
> it, to be precise) is initialized into the subtransaction resource
> owner, which is released at subtransaction commit.

Got it. So doesn't tuplesort have the same issue?

The patch definitely requires more than zero comments.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2009-12-22 18:57:02 Re: Backup history file should be replicated in Streaming Replication?
Previous Message Simon Riggs 2009-12-22 18:54:40 Streaming Rep - 2-phase backups and reducing time to full replication