summaryrefslogtreecommitdiff
path: root/src/backend/commands
diff options
context:
space:
mode:
authorMichael Paquier2024-09-03 00:11:54 +0000
committerMichael Paquier2024-09-03 00:11:54 +0000
commitc7cd2d6ed082a4638172acece33ed6f36da96263 (patch)
treef4a8ab1b49eac09019d6b6a6114e9d9a00e9f1a8 /src/backend/commands
parent94eec79633f284488de69e253857e44aad10c730 (diff)
Define PG_TBLSPC_DIR for path pg_tblspc/ in data folder
Similarly to 2065ddf5e34c, this introduces a define for "pg_tblspc". This makes the style more consistent with the existing PG_STAT_TMP_DIR, for example. There is a difference with the other cases with the introduction of PG_TBLSPC_DIR_SLASH, required in two places for recovery and backups. Author: Bertrand Drouvot Reviewed-by: Ashutosh Bapat, Álvaro Herrera, Yugo Nagata, Michael Paquier Discussion: https://postgr.es/m/[email protected]
Diffstat (limited to 'src/backend/commands')
-rw-r--r--src/backend/commands/dbcommands.c2
-rw-r--r--src/backend/commands/tablespace.c4
2 files changed, 3 insertions, 3 deletions
diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c
index d00ae40e192..8be435a79e9 100644
--- a/src/backend/commands/dbcommands.c
+++ b/src/backend/commands/dbcommands.c
@@ -3257,7 +3257,7 @@ recovery_create_dbdir(char *path, bool only_tblspc)
if (stat(path, &st) == 0)
return;
- if (only_tblspc && strstr(path, "pg_tblspc/") == NULL)
+ if (only_tblspc && strstr(path, PG_TBLSPC_DIR_SLASH) == NULL)
elog(PANIC, "requested to created invalid directory: %s", path);
if (reachedConsistency && !allow_in_place_tablespaces)
diff --git a/src/backend/commands/tablespace.c b/src/backend/commands/tablespace.c
index 113b4807315..00c1ed19fdf 100644
--- a/src/backend/commands/tablespace.c
+++ b/src/backend/commands/tablespace.c
@@ -576,7 +576,7 @@ create_tablespace_directories(const char *location, const Oid tablespaceoid)
struct stat st;
bool in_place;
- linkloc = psprintf("pg_tblspc/%u", tablespaceoid);
+ linkloc = psprintf("%s/%u", PG_TBLSPC_DIR, tablespaceoid);
/*
* If we're asked to make an 'in place' tablespace, create the directory
@@ -692,7 +692,7 @@ destroy_tablespace_directories(Oid tablespaceoid, bool redo)
char *subfile;
struct stat st;
- linkloc_with_version_dir = psprintf("pg_tblspc/%u/%s", tablespaceoid,
+ linkloc_with_version_dir = psprintf("%s/%u/%s", PG_TBLSPC_DIR, tablespaceoid,
TABLESPACE_VERSION_DIRECTORY);
/*