Re: pg_dumpall --roles-only interact with other options

Zsolt Parragi <zsolt.parragi@percona.com>

From: Zsolt Parragi <zsolt.parragi@percona.com>
To: Chao Li <li.evan.chao@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, jian he <jian.universality@gmail.com>, wangpeng <215722532@qq.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-03-03T07:40:22Z
Lists: pgsql-hackers
This is definitely better. I suggested an array based approach back in
my first email to the thread, and that didn't get any positive
feedback, so I thought people prefer the simple ifs.

- pg_log_error_hint("Try \"%s --help\" for more information.", progname);

This error hint comment is now missing, was that intentional?

+ CheckMutuallyExclusiveOpts(12, globals_only, "-g/--globals-only",
+    roles_only, "-r/--roles-only",
+    tablespaces_only, "-t/--tablespaces-only",
+    data_only, "-a/--data-only",
+    schema_only, "-s/--schema-only",
+    statistics_only, "--statistics-only");
+ CheckMutuallyExclusiveOpts(12,
+    globals_only, "-g/--globals-only",
+    roles_only, "-r/--roles-only",
+    tablespaces_only, "-t/--tablespaces-only",
+    schema_only, "-s/--schema-only",
+    data_only, "-a/--data-only",
+    with_statistics, "--statistics");

This was confusing it at first. data_only schema_only are present on
both but in different order, the only real difference is
with_statistics/statistics_only. I would fix the order and add a
comment that only the last item differs.



Commits

  1. pg_dumpall: Fix handling of conflicting options.

  2. pg_dump: Add dumpSchema and dumpData derivative flags.