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

jian he <jian.universality@gmail.com>

From: jian he <jian.universality@gmail.com>
To: wangpeng <215722532@qq.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-02-04T08:14:59Z
Lists: pgsql-hackers

Attachments

On Wed, Feb 4, 2026 at 9:56 AM wangpeng <215722532@qq.com> wrote:
>
> Hi,
> I reviewed and tested this patch. I noticed that:
>    pg_dumpall --globals-only --statistics        ----> error
>    pg_dumpall --globals-only --statistics-only   ----> pass
> maybe there is inconsistent for *-only options
> is that intentional?
>

Thanks for pointing this out.
It should fail too. I missed this combination.
The attached v2 should be bullet-proof.

On Wed, Feb 4, 2026 at 5:25 AM Nathan Bossart <nathandbossart@gmail.com> wrote:
>
> 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.

https://git.postgresql.org/cgit/postgresql.git/commit/?id=96a81c1be929d122719bd289f6e24824f37e1ff6
added new fields to RestoreOptions and DumpOptions.

These global objects dump(roles, tablespaces) are not directly related to
pg_restore for now, pg_restore does not support options like --roles-only
or --tablespaces-only. Creating "derivative flags" requires careful
consideration of their default values, which adds complexity for relatively
little benefit. Overall we don't need to implement similar logic now, i think.

commitgest entry: https://commitfest.postgresql.org/patch/6459


--
jian
https://www.enterprisedb.com/

Commits

  1. pg_dumpall: Fix handling of conflicting options.

  2. pg_dump: Add dumpSchema and dumpData derivative flags.