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

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: pg_dumpall --roles-only interact with other options
Дата
Msg-id aYJn4n7cEXIRR-xm@nathan
обсуждение исходный текст
Ответ на Re: pg_dumpall --roles-only interact with other options  (jian he <jian.universality@gmail.com>)
Список 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



В списке pgsql-hackers по дате отправления: