aboutsummaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2025-02-25 09:02:07 -0500
committerAndres Freund <andres@anarazel.de>2025-02-25 09:02:07 -0500
commit37c87e63f9e1a2d76db54fedcdf91d3895d200a6 (patch)
tree1289dd23f92391ef9ec5171b59f4ac76f2e14a02 /src/tools
parent32c393f9f1f148febcd741e7067e9537825587cc (diff)
downloadpostgresql-37c87e63f9e1a2d76db54fedcdf91d3895d200a6.tar.gz
postgresql-37c87e63f9e1a2d76db54fedcdf91d3895d200a6.zip
Change relpath() et al to return path by value
For AIO, and also some other recent patches, we need the ability to call relpath() in a critical section. Until now that was not feasible, as it allocated memory. The fact that relpath() allocated memory also made it awkward to use in log messages because we had to take care to free the memory afterwards. Which we e.g. didn't do for when zeroing out an invalid buffer. We discussed other solutions, e.g. filling a pre-allocated buffer that's passed to relpath(), but they all came with plenty downsides or were larger projects. The easiest fix seems to be to make relpath() return the path by value. To be able to return the path by value we need to determine the maximum length of a relation path. This patch adds a long #define that computes the exact maximum, which is verified to be correct in a regression test. As this change the signature of relpath(), extensions using it will need to adapt their code. We discussed leaving a backward-compat shim in place, but decided it's not worth it given the use of relpath() doesn't seem widespread. Discussion: https://postgr.es/m/xeri5mla4b5syjd5a25nok5iez2kr3bm26j2qn4u7okzof2bmf@kwdh2vf7npra
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/pgindent/typedefs.list1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/tools/pgindent/typedefs.list b/src/tools/pgindent/typedefs.list
index e3e09a2207e..4200cf2fee8 100644
--- a/src/tools/pgindent/typedefs.list
+++ b/src/tools/pgindent/typedefs.list
@@ -2410,6 +2410,7 @@ RelMapFile
RelMapping
RelOptInfo
RelOptKind
+RelPathStr
RelStatsInfo
RelToCheck
RelToCluster