| From: | Nathan Bossart <nathandbossart(at)gmail(dot)com> |
|---|---|
| To: | jian he <jian(dot)universality(at)gmail(dot)com> |
| Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: pg_dumpall --roles-only interact with other options |
| Date: | 2026-02-03 21:25:54 |
| Message-ID: | aYJn4n7cEXIRR-xm@nathan |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Tue, Feb 03, 2026 at 10:15:35AM +0800, jian he wrote:
> please check the attached.
Thanks.
> - {"statistics", no_argument, &with_statistics, 1},
> - {"statistics-only", no_argument, &statistics_only, 1},
> + {"statistics", no_argument, NULL, 10},
> + {"statistics-only", no_argument, NULL, 11},
nitpick: I don't totally disagree with these changes, but they are
unrelated to the patch at hand, so I think we'd better leave them out.
> + /* reject conflicting "-only" options */
> + if (globals_only && with_statistics)
> + pg_fatal("options %s and %s cannot be used together",
> + "-g/--globals-only", "--statistics");
> +
> + if (data_only && roles_only)
> + pg_fatal("options %s and %s cannot be used together",
> + "-a/--data-only", "-r/--roles-only");
> [...]
> +
> + if (data_only && tablespaces_only)
> + pg_fatal("options %s and %s cannot be used together",
> + "-a/--data-only", "-t/--tablespaces-only");
> [...]
Could we integrate this into the existing handling for conflicting options
a few lines above this point?
> - if (!data_only && !statistics_only && !no_schema)
I wonder if we ought to create "derivative flags" like we did for pg_dump
in commit 96a81c1be9. That could make some of this stuff easier to
maintain and to follow.
> diff --git a/src/bin/pg_dump/t/002_pg_dump.pl b/src/bin/pg_dump/t/002_pg_dump.pl
> index a8dcc2b5c75..340cf953a60 100644
> --- a/src/bin/pg_dump/t/002_pg_dump.pl
> +++ b/src/bin/pg_dump/t/002_pg_dump.pl
> @@ -322,7 +322,6 @@ my %pgdump_runs = (
> '--file' => "$tempdir/pg_dumpall_globals.sql",
> '--globals-only',
> '--no-sync',
> - '--statistics',
> ],
> },
> pg_dumpall_globals_clean => {
> @@ -332,7 +331,6 @@ my %pgdump_runs = (
> '--globals-only',
> '--clean',
> '--no-sync',
> - '--statistics',
> ],
> },
> pg_dumpall_dbprivs => {
Could you add some new tests for the conflicting options?
--
nathan
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Ants Aasma | 2026-02-03 21:42:26 | Re: New access method for b-tree. |
| Previous Message | Zsolt Parragi | 2026-02-03 21:10:12 | Re: Patch: dumping tables data in multiple chunks in pg_dump |