Re: GetRelationPath() vs critical sections

Andres Freund <andres@anarazel.de>

From: Andres Freund <andres@anarazel.de>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Thomas Munro <thomas.munro@gmail.com>, Andy Fan <zhihuifan1213@163.com>, pgsql-hackers@postgresql.org, Noah Misch <noah@leadboat.com>, Michael Paquier <michael.paquier@gmail.com>
Date: 2025-02-24T15:50:21Z
Lists: pgsql-hackers

Attachments

Hi,

On 2025-02-20 15:28:39 -0500, Andres Freund wrote:
> On 2025-02-20 14:11:16 -0500, Tom Lane wrote:
> > As a matter of style, I wonder if it'd be better to have these
> > functions write into a caller-supplied variable.
> 
> I wondered about that too, it does however make some code more awkward,
> e.g. because there's not a good surrounding block to put the variable in.
> 
> I mildly prefer the return-by-value approach, but not more.

Since I've not heard anything on that point, I'm currently thinking with going
with return-by-value. Attached are two very mildly updated patches. Most of
the changes is added commit messages.

Greetings,

Andres Freund

Commits

  1. Change _mdfd_segpath() to return paths by value

  2. Change relpath() et al to return path by value