0001-pg_upgrade-Add-copy-option.patch
text/plain
Filename: 0001-pg_upgrade-Add-copy-option.patch
Type: text/plain
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0001
Subject: pg_upgrade: Add --copy option
| File | + | − |
|---|---|---|
| doc/src/sgml/ref/pgupgrade.sgml | 10 | 0 |
| src/bin/pg_upgrade/option.c | 6 | 0 |
From e01feabdfc0e2ea01242afd93261885c035e7942 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Thu, 1 Dec 2022 15:34:00 +0100
Subject: [PATCH 1/2] pg_upgrade: Add --copy option
This option selects the default transfer mode. Having an explicit
option is handy to make scripts and tests more explicit. It also
makes it easier to talk about a "copy" mode rather than "the default
mode" or something like that, since until now the default mode didn't
have an externally visible name.
---
doc/src/sgml/ref/pgupgrade.sgml | 10 ++++++++++
src/bin/pg_upgrade/option.c | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/doc/src/sgml/ref/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
index 8f7a3025c368..7816b4c6859b 100644
--- a/doc/src/sgml/ref/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -230,6 +230,16 @@ <title>Options</title>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term><option>--copy</option></term>
+ <listitem>
+ <para>
+ Copy files to the new cluster. This is the default. (See also
+ <option>--link</option> and <option>--clone</option>.)
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term><option>-?</option></term>
<term><option>--help</option></term>
diff --git a/src/bin/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c
index f441668c612a..f986129c2fb9 100644
--- a/src/bin/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -56,6 +56,7 @@ parseCommandLine(int argc, char *argv[])
{"socketdir", required_argument, NULL, 's'},
{"verbose", no_argument, NULL, 'v'},
{"clone", no_argument, NULL, 1},
+ {"copy", no_argument, NULL, 2},
{NULL, 0, NULL, 0}
};
@@ -194,6 +195,10 @@ parseCommandLine(int argc, char *argv[])
user_opts.transfer_mode = TRANSFER_MODE_CLONE;
break;
+ case 2:
+ user_opts.transfer_mode = TRANSFER_MODE_COPY;
+ break;
+
default:
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
os_info.progname);
@@ -283,6 +288,7 @@ usage(void)
printf(_(" -v, --verbose enable verbose internal logging\n"));
printf(_(" -V, --version display version information, then exit\n"));
printf(_(" --clone clone instead of copying files to new cluster\n"));
+ printf(_(" --copy copy files to new cluster (default)\n"));
printf(_(" -?, --help show this help, then exit\n"));
printf(_("\n"
"Before running pg_upgrade you must:\n"
base-commit: ec386948948c1708c0c28c48ef08b9c4dd9d47cc
--
2.38.1