Re: pg_dumpall --roles-only interact with other options - Mailing list pgsql-hackers

From Zsolt Parragi
Subject Re: pg_dumpall --roles-only interact with other options
Date
Msg-id CAN4CZFPaUtO6eaF_7QEqSPmqfJsH7yQGFF6VUAGdd3uq1RA56g@mail.gmail.com
Whole thread Raw
In response to Re: pg_dumpall --roles-only interact with other options  (jian he <jian.universality@gmail.com>)
Responses Re: pg_dumpall --roles-only interact with other options
List pgsql-hackers
> 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.

The variables also should use under_score names, not camelCase.


And these two produce empty dumps, maybe they could result in errors instead:

pg_dumpall --globals-only --schema-only
pg_dumpall --globals-only --data-only

These produce an empty dump with a pg_dump error message, as pg_dump
blocks them, so they could use early errors:

pg_dumpall --data-only --statistics-only
pg_dumpall --schema-only --statistics-only
pg_dumpall --data-only --schema-only


I also wonder if it would be better to use a simple static array with
a helper struct to describe the blocked pairs, iterating it with a
simple for loop and generating error messages dynamically, instead of
manual copy-paste and editing. This if list is already getting quite
long, and it doesn't contain all combinations that should be blocked
yet.

E.g.

incompatible_options[] = { { &globals_only, &roles_only,
"-g/--globals-only",  "-r/--roles-only" }, ... }



pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: pg_upgrade: transfer pg_largeobject_metadata's files when possible
Next
From: Sami Imseih
Date:
Subject: Re: Fix pg_stat_get_backend_wait_event() for aux processes