Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it
Date
Msg-id 23440.1357674809@sss.pgh.pa.us
Whole thread Raw
In response to Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it  (Andres Freund <andres@2ndquadrant.com>)
Responses Re: [PATCH 2/5] Make relpathbackend return a statically result instead of palloc()'ing it
List pgsql-hackers
Andres Freund <andres@2ndquadrant.com> writes:
> On 2013-01-08 14:28:14 -0500, Tom Lane wrote:
>> I'm 100% unimpressed with making relpathbackend return a pointer to a
>> static buffer.  Who's to say whether that won't create bugs due to
>> overlapping usages?

> I say it ;). I've gone through all callers and checked. Not that that
> guarantees anything, but ...

Even if you've proven it safe today, it seems unnecessarily fragile.
Just about any other place we've used a static result buffer, we've
regretted it, unless the use cases were *very* narrow.

> The reason a static buffer is better is that some of the *desc routines
> use relpathbackend() and pfree() the result. That would require
> providing a stub pfree() in xlogdump which seems to be exceedingly ugly.

Why?  If we have palloc support how hard can it be to map pfree to free?
And why wouldn't we want to?  I can hardly imagine providing only palloc
and not pfree support.
        regards, tom lane



pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Cascading replication: should we detect/prevent cycles?
Next
From: David Fetter
Date:
Subject: Re: Cascading replication: should we detect/prevent cycles?