> 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" }, ... }