Re: WIP: pl/pgsql cleanup - Mailing list pgsql-patches

From Neil Conway
Subject Re: WIP: pl/pgsql cleanup
Date
Msg-id 1106280288.22946.274.camel@localhost.localdomain
Whole thread Raw
In response to Re: WIP: pl/pgsql cleanup  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-patches
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.

-Neil



pgsql-patches by date:

Previous
From: Euler Taveira de Oliveira
Date:
Subject: Re: uptime function to postmaster
Next
From: Stephen Frost
Date:
Subject: Merge pg_shadow && pg_group -- UNTESTED