This commit teaches pg_dumpall to fail when both --clean and
--data-only are specified. Previously, it passed the options
through to pg_dump, which would fail after pg_dumpall had already
started producing output. Like recent commits
b2898baaf7 and
7c8280eeb5, no back-patch.
Author: Mahendra Singh Thalor <mahi6run@gmail.com>
Reviewed-by: Srinath Reddy Sadipiralla <srinath2133@gmail.com>
Discussion: https://postgr.es/m/CAKYtNArrHiJ0LDB9BFZiUWs6tC78QkBN50wiwO07WhxewYDS3Q%40mail.gmail.com
schema_only, "-s/--schema-only",
tablespaces_only, "-t/--tablespaces-only");
+ /* --clean and --data-only are incompatible */
+ check_mut_excl_opts(output_clean, "-c/--clean",
+ data_only, "-a/--data-only");
+
if (if_exists && !output_clean)
pg_fatal("option %s requires option %s",
"--if-exists", "-c/--clean");
qr/\Qpg_dump: error: options -c\/--clean and -a\/--data-only cannot be used together\E/,
'pg_dump: options -c/--clean and -a/--data-only cannot be used together');
+command_fails_like(
+ [ 'pg_dumpall', '-c', '-a' ],
+ qr/\Qpg_dumpall: error: options -c\/--clean and -a\/--data-only cannot be used together\E/,
+ 'pg_dumpall: options -c/--clean and -a/--data-only cannot be used together');
+
command_fails_like(
[ 'pg_restore', '-c', '-a', '-f -' ],
qr/\Qpg_restore: error: options -c\/--clean and -a\/--data-only cannot be used together\E/,