Skip site navigation (1) Skip section navigation (2)

Re: WIP: pl/pgsql cleanup

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Neil Conway <neilc(at)samurai(dot)com>
Cc: pgsql-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Re: WIP: pl/pgsql cleanup
Date: 2005-01-20 12:57:59
Message-ID: 5283.1106225879@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
Neil Conway <neilc(at)samurai(dot)com> writes:
> On Tue, 2005-01-18 at 01:02 -0500, Tom Lane wrote:
>> It might be better to keep CurrentMemoryContext pointing at a temp
>> context, and translate malloc() to MemoryContextAlloc(function_context)
>> rather than just palloc().  (Of course you could hide this in a macro,
>> maybe falloc()?)

> Are there really enough short-lived pallocs that this is worth the
> trouble?

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.

> One potential issue is that there are plenty of places where
> we'd want to falloc(), but don't have the function easily available
> (e.g. in the parser).

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.

			regards, tom lane

In response to

Responses

pgsql-patches by date

Next:From: Peter EisentrautDate: 2005-01-20 13:08:20
Subject: Translations at pgfoundry (was Re: [PATCHES] Latest Turkish translation updates)
Previous:From: Zhenbang WeiDate: 2005-01-20 07:26:53
Subject: psql zh_TW translation update for CURRENT

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group