| From: | jian he <jian(dot)universality(at)gmail(dot)com> |
|---|---|
| To: | Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> |
| Cc: | Nathan Bossart <nathandbossart(at)gmail(dot)com>, wangpeng <215722532(at)qq(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: pg_dumpall --roles-only interact with other options |
| Date: | 2026-02-06 06:43:47 |
| Message-ID: | CACJufxEpPEDsxgppQg41nyPyBQX4+DBRRUnysaBYwRuCqdF48g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Feb 6, 2026 at 4:35 AM Zsolt Parragi <zsolt(dot)parragi(at)percona(dot)com> wrote:
>
> > The attached patch also addresses the points mentioned by Zsolt Parragi.
>
> old:
>
> - if (!data_only && !statistics_only && !no_schema)
>
> new:
>
> + shouldDumpTablespaces = !roles_only && !no_tablespaces && !data_only
> && !schema_only && !statistics_only;
> + shouldDumpRoles = !tablespaces_only && !data_only && !schema_only &&
> !statistics_only;
>
> This is still a user visible change: no_schema -> schema_only
>
> And I don't think this change is good, roles and tablespaces are part
> of the schema, without them, DDL statements later can fail.
>
hi.
I believe "schema" generally refers to object definitions, excluding
things like roles and tablespaces.
I tend to think that once "only" is specified, the "no" option meaning
is not applied,
thus I'm ok with
pg_dumpall --globals-only --no-schema
is equivalent to
pg_dumpall --globals-only
For all these pg_dumpall combination
--roles-only
--tablespaces-only
--statistics-only
--schema-only
--globals-only
--data-only
--statistics
The only allowed combination is --statistics --statistics-only.
since pg_dump also supports it, and these two option meanings do not contradict.
please check v4, it looks very neat, IMHO.
for example:
+ if (schema_only && (with_statistics || statistics_only))
+ {
+ pg_log_error("options %s and %s cannot be used together",
+ "-s/--schema-only",
+ statistics_only ? "--statistics-only" :
+ "--statistics");
+
src/bin/pg_dump/t/001_basic.pl tests are well aligned with pg_dumpall.c code, so
it's quite easy to review.
| Attachment | Content-Type | Size |
|---|---|---|
| v4-0001-pg_dumpall-error-out-conflict-options.patch | text/x-patch | 12.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-02-06 06:44:27 | Re: Small fixes for incorrect error messages |
| Previous Message | Junwang Zhao | 2026-02-06 06:19:11 | Re: Emitting JSON to file using COPY TO |