v1-0001-Fix-small-mistakes-around-pg_combinebackup-with-t.patch

application/octet-stream

Filename: v1-0001-Fix-small-mistakes-around-pg_combinebackup-with-t.patch
Type: application/octet-stream
Part: 0
Message: some additional (small) problems with pg_combinebackup and tablespaces

Patch

Format: format-patch
Series: patch v1-0001
Subject: Fix small mistakes around pg_combinebackup with tablespaces.
File+
doc/src/sgml/ref/pg_combinebackup.sgml 1 1
src/bin/pg_combinebackup/pg_combinebackup.c 1 1
From 1b66085133c11fb18da72c47f54c10c41c597578 Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Wed, 24 Apr 2024 13:49:05 -0400
Subject: [PATCH v1] Fix small mistakes around pg_combinebackup with
 tablespaces.

The --tablespace-mapping option was specified with required_argument
rather than no_argument, which is wrong. Since the actual argument
string passed to getopt_long() included "T:", the single-character
form of the option still worked, but the long form did not. Repair.

Also, the documentation erroneously stated that the tablespace
mappings would be applied relative to the pathnames in the first
backup specified on the command line. In fact, the tablespace
mappings are interpreted relative to the final backup specified on
the command line. Correct the error.

Thanks to Tomas Vondra for alerting me to these mistakes.
---
 doc/src/sgml/ref/pg_combinebackup.sgml      | 2 +-
 src/bin/pg_combinebackup/pg_combinebackup.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/doc/src/sgml/ref/pg_combinebackup.sgml b/doc/src/sgml/ref/pg_combinebackup.sgml
index 96df3d81f1..89ee92d6a7 100644
--- a/doc/src/sgml/ref/pg_combinebackup.sgml
+++ b/doc/src/sgml/ref/pg_combinebackup.sgml
@@ -128,7 +128,7 @@ PostgreSQL documentation
         Relocates the tablespace in directory <replaceable>olddir</replaceable>
         to <replaceable>newdir</replaceable> during the backup.
         <replaceable>olddir</replaceable> is the absolute path of the tablespace
-        as it exists in the first backup specified on the command line,
+        as it exists in the final backup specified on the command line,
         and <replaceable>newdir</replaceable> is the absolute path to use for the
         tablespace in the reconstructed backup.  If either path needs to contain
         an equal sign (<literal>=</literal>), precede that with a backslash.
diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c
index 4958372653..753c40874c 100644
--- a/src/bin/pg_combinebackup/pg_combinebackup.c
+++ b/src/bin/pg_combinebackup/pg_combinebackup.c
@@ -126,7 +126,7 @@ main(int argc, char *argv[])
 		{"dry-run", no_argument, NULL, 'n'},
 		{"no-sync", no_argument, NULL, 'N'},
 		{"output", required_argument, NULL, 'o'},
-		{"tablespace-mapping", no_argument, NULL, 'T'},
+		{"tablespace-mapping", required_argument, NULL, 'T'},
 		{"manifest-checksums", required_argument, NULL, 1},
 		{"no-manifest", no_argument, NULL, 2},
 		{"sync-method", required_argument, NULL, 3},
-- 
2.39.3 (Apple Git-145)