diff --git a/doc/src/sgml/ref/pg_combinebackup.sgml b/doc/src/sgml/ref/pg_combinebackup.sgml index 79c73ad460d..55bc46849db 100644 --- a/doc/src/sgml/ref/pg_combinebackup.sgml +++ b/doc/src/sgml/ref/pg_combinebackup.sgml @@ -196,7 +196,7 @@ PostgreSQL documentation Perform regular file copy. This is the default. (See also - , and + , , and /.) diff --git a/src/bin/pg_combinebackup/copy_file.c b/src/bin/pg_combinebackup/copy_file.c index f4f38e9ad71..97ecda5a66d 100644 --- a/src/bin/pg_combinebackup/copy_file.c +++ b/src/bin/pg_combinebackup/copy_file.c @@ -73,12 +73,11 @@ copy_file(const char *src, const char *dst, #ifdef WIN32 /* - * Windows only supports two "copy methods": CopyFile and - * CreateHardLink. Whenever the user selects a method other than - * --link, we force pg_combinebackup to use CopyFile, as --clone and - * --copy-file-range are not supported in that platform. + * We have no specific switch to enable CopyFile on Windows, because + * it's supported (as far as we know) on all Windows machines. So, + * automatically enable it unless some other strategy was selected. */ - if (copy_method != COPY_METHOD_LINK) + if (copy_method == COPY_METHOD_COPY) copy_method = COPY_METHOD_COPYFILE; #endif diff --git a/src/bin/pg_combinebackup/pg_combinebackup.c b/src/bin/pg_combinebackup/pg_combinebackup.c index e005b033ed0..d480dc74436 100644 --- a/src/bin/pg_combinebackup/pg_combinebackup.c +++ b/src/bin/pg_combinebackup/pg_combinebackup.c @@ -173,7 +173,7 @@ main(int argc, char *argv[]) opt.copy_method = COPY_METHOD_COPY; /* process command-line options */ - while ((c = getopt_long(argc, argv, "dnNo:T:k", + while ((c = getopt_long(argc, argv, "dknNo:T:", long_options, &optindex)) != -1) { switch (c) @@ -182,6 +182,9 @@ main(int argc, char *argv[]) opt.debug = true; pg_logging_increase_verbosity(); break; + case 'k': + opt.copy_method = COPY_METHOD_LINK; + break; case 'n': opt.dry_run = true; break; @@ -194,9 +197,6 @@ main(int argc, char *argv[]) case 'T': add_tablespace_mapping(&opt, optarg); break; - case 'k': - opt.copy_method = COPY_METHOD_LINK; - break; case 1: if (!pg_checksum_parse_type(optarg, &opt.manifest_checksums)) @@ -770,12 +770,12 @@ help(const char *progname) printf(_(" %s [OPTION]... DIRECTORY...\n"), progname); printf(_("\nOptions:\n")); printf(_(" -d, --debug generate lots of debugging output\n")); + printf(_(" -k, --link link files instead of copying\n")); printf(_(" -n, --dry-run do not actually do anything\n")); printf(_(" -N, --no-sync do not wait for changes to be written safely to disk\n")); printf(_(" -o, --output=DIRECTORY output directory\n")); printf(_(" -T, --tablespace-mapping=OLDDIR=NEWDIR\n" " relocate tablespace in OLDDIR to NEWDIR\n")); - printf(_(" -k, --link link files instead of copying\n")); printf(_(" --clone clone (reflink) files instead of copying\n")); printf(_(" --copy copy files (default)\n")); printf(_(" --copy-file-range copy using copy_file_range() system call\n"));