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

Zsolt Parragi <zsolt.parragi@percona.com>

From: Zsolt Parragi <zsolt.parragi@percona.com>
To: jian he <jian.universality@gmail.com>
Cc: Nathan Bossart <nathandbossart@gmail.com>, wangpeng <215722532@qq.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2026-02-09T19:09:54Z
Lists: pgsql-hackers
> It would be better to simply reject the CONFLICT ONLY option and keep the rest
> of the logic same as the HEAD.

I agree, that's why I showed that test case that failed.

This version is definitely better, it's also more readable than the
previous version with the many ifs.

But it is again missing a few cases that should error out before
pg_dump, as currently it fails after pg_dump errors out:

--schema-only --no-schema
--data-only --no-data
--statistics-only --no-statistics


  /* Make sure the user hasn't specified a mix of globals-only options */
- if (globals_only && roles_only)
+ if (globals_only &&
+ (roles_only || tablespaces_only || with_statistics ||
statistics_only || schema_only || data_only))


The comment above the checks also seems stale, as we have more checks
with the patch



Commits

  1. pg_dumpall: Fix handling of conflicting options.

  2. pg_dump: Add dumpSchema and dumpData derivative flags.