From: | Joe Conway <mail(at)joeconway(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | SRF memory mgmt patch (was [HACKERS] Concern about memory management with SRFs) |
Date: | 2002-08-29 06:53:55 |
Message-ID: | 3D6DC503.3060802@joeconway.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Tom Lane wrote:
> Joe Conway <mail(at)joeconway(dot)com> writes:
>>Is it OK to use fcinfo->flinfo->fn_mcxt as the long term memory
>>context or is there a better choice?
>
> That is the correct choice.
>
>>Is funcctx->multi_call_memory_ctx a
>>suitable name in place of funcctx->fmctx?
>
> No objection here.
Here's a patch to address Tom's SRF API memory management concerns, as
discussed earlier today on HACKERS.
Please note that, although this should apply cleanly on cvs tip, it will
have (two) failed hunks (nodeFunctionscan.c) *if* applied after Neil's
plpgsql SRF patch. Or it will cause a failure in Neil's patch if it is
applied first (I think). The fix in either case is to wrap the loop that
collects rows from the function and stashes them in the tuplestore as
follows:
do until no more tuples
+ ExprContext *econtext = scanstate->csstate.cstate.cs_ExprContext;
get one tuple
put it in the tuplestore
+ ResetExprContext(econtext);
loop
Also note that contrib/dblink is intentionally missing, because I'm
still working on other aspects of it. I'll have an updated dblink in a
day or so.
If there are no objections, please apply.
Thanks,
Joe
Attachment | Content-Type | Size |
---|---|---|
srf-api-memctx.1.patch | text/plain | 19.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Mario Weilguni | 2002-08-29 06:57:06 | Re: C vs. C++ contributions |
Previous Message | Tom Lane | 2002-08-29 05:34:01 | Re: [SQL] LIMIT 1 FOR UPDATE or FOR UPDATE LIMIT 1? |
From | Date | Subject | |
---|---|---|---|
Next Message | Neil Conway | 2002-08-29 07:26:25 | Re: revised patch for PL/PgSQL table functions |
Previous Message | Tom Lane | 2002-08-29 05:22:14 | Re: small mistakes in func.sgml |