Re: GetRelationPath() vs critical sections

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Andres Freund <andres@anarazel.de>
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-20T19:11:16Z
Lists: pgsql-hackers
Andres Freund <andres@anarazel.de> writes:
> Does anybody have opinions about whether we should keep a backward compatible
> interface in place or not?

I vote for "not" --- doesn't seem like there'll be much external
code affected, and we make comparably-sized API breaks all the time.

As a matter of style, I wonder if it'd be better to have these
functions write into a caller-supplied variable.  That seems more
in keeping with most other places in Postgres, and it would save
a copying step in cases where the caller needs the result on the
heap.  I realize that returning structs has been in C for decades,
but that doesn't mean I want some of our APIs doing it one way and
some the other.

			regards, tom lane



Commits

  1. Change _mdfd_segpath() to return paths by value

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