Skip to content

Commit 746915c

Browse files
committed
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. Reviewed-by: Daniel Gustafsson <daniel@yesql.se> Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/50a97009-8ff9-ca4d-a0f6-6086a6775a5b%40enterprisedb.com
1 parent 5934620 commit 746915c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

doc/src/sgml/ref/pgupgrade.sgml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,16 @@ PostgreSQL documentation
230230
</listitem>
231231
</varlistentry>
232232

233+
<varlistentry>
234+
<term><option>--copy</option></term>
235+
<listitem>
236+
<para>
237+
Copy files to the new cluster. This is the default. (See also
238+
<option>--link</option> and <option>--clone</option>.)
239+
</para>
240+
</listitem>
241+
</varlistentry>
242+
233243
<varlistentry>
234244
<term><option>-?</option></term>
235245
<term><option>--help</option></term>

src/bin/pg_upgrade/option.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ parseCommandLine(int argc, char *argv[])
5656
{"socketdir", required_argument, NULL, 's'},
5757
{"verbose", no_argument, NULL, 'v'},
5858
{"clone", no_argument, NULL, 1},
59+
{"copy", no_argument, NULL, 2},
5960

6061
{NULL, 0, NULL, 0}
6162
};
@@ -194,6 +195,10 @@ parseCommandLine(int argc, char *argv[])
194195
user_opts.transfer_mode = TRANSFER_MODE_CLONE;
195196
break;
196197

198+
case 2:
199+
user_opts.transfer_mode = TRANSFER_MODE_COPY;
200+
break;
201+
197202
default:
198203
fprintf(stderr, _("Try \"%s --help\" for more information.\n"),
199204
os_info.progname);
@@ -283,6 +288,7 @@ usage(void)
283288
printf(_(" -v, --verbose enable verbose internal logging\n"));
284289
printf(_(" -V, --version display version information, then exit\n"));
285290
printf(_(" --clone clone instead of copying files to new cluster\n"));
291+
printf(_(" --copy copy files to new cluster (default)\n"));
286292
printf(_(" -?, --help show this help, then exit\n"));
287293
printf(_("\n"
288294
"Before running pg_upgrade you must:\n"

0 commit comments

Comments
 (0)