Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset
Date: 2015-02-26 22:16:59
Message-ID: 29694.1424989019@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> writes:
> Tom Lane wrote:
>> Thoughts? Any objections to pushing this?

> Is there any reason at all to keep
> MemoryContextResetButPreserveChildren()? Since your patch doesn't add
> any callers, it seems pretty likely that there's none anywhere.

The only reason to keep it is to have an "out" if it turns out that some
third-party code actually needs that behavior.

On reflection, maybe a better API to offer for that eventuality is a
function named something like MemoryContextResetOnly(), which would
leave child contexts completely alone. Then, if you want the old
functionality, you could get it with MemoryContextResetOnly plus
MemoryContextResetChildren.

BTW, the original thread discussed the idea of moving context bookkeeping
blocks into the immediate parent context, but the usefulness of
MemoryContextSetParent() negates the thought that that would be a good
plan. So there's no real issue here other than potential backwards
compatibility for external code.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2015-02-26 22:31:16 Re: Renaming MemoryContextResetAndDeleteChildren to MemoryContextReset
Previous Message Jim Nasby 2015-02-26 22:16:54 Re: logical column ordering