On Thu, 2005-01-20 at 07:57 -0500, Tom Lane wrote:
> Not sure, but it seems like at least as straightforward a translation
> as the other way. More to the point, it makes clear the difference
> between what is meant to be a long-lived data structure and what isn't.
The latter point is sound, I think -- making that distinction clear
would be nice.
One problem is that this prevents easily using List in pl_comp.c and
gram.y, which is a shame. One solution would be to switch the
CurrentMemoryContext to the function's memory context, and provide a
macro to allocate short-lived memory that can be thrown away at the end
of do_compile(). Alternatively, we could provide some means to allow the
caller of the List API functions to specify the context in which list.c
allocations should be performed.
> Why not? You'd need to keep the context-to-use in a static variable,
> but that's no great difficulty considering that plpgsql function
> parsing needn't be re-entrant.
Yeah, that's fair -- there's already a plpgsql_curr_compile variable, so
we needn't even add another.
In response to
pgsql-patches by date
|Next:||From: Stephen Frost||Date: 2005-01-21 05:59:17|
|Subject: Merge pg_shadow && pg_group -- UNTESTED|
|Previous:||From: Euler Taveira de Oliveira||Date: 2005-01-21 03:54:17|
|Subject: Re: uptime function to postmaster|