On Sat, Aug 2, 2025 at 4:42 AM Jeff Davis <[email protected]> wrote:
> Patch attached.
>
> * removes --with-data and --with-schema (redundant)
> * renames --with-statistics to just --statistics
>
> I kept --statistics and --no-statistics for both pg_dump and
> pg_restore, because: (a) I think it's good to have consistent options
> between those two programs; and (b) it allows us to potentially change
> the default to include statistics in the future. That leaves some
> redundancy of the options, which some have expressed annoyance over,
> but it doesn't seem like a major point of objection.
I'm OK with this approach. Thanks for the patch! It looks good to me.
While not directly related to your patch, I feel inclined to simplify option
handling in pg_dump, similar to what we've already done in pg_restore.c
and pg_dumpall.c. For example, we could change how statistics_only is handled
like this:
---------------------------------------
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -448,7 +448,7 @@ main(int argc, char **argv)
DataDirSyncMethod sync_method = DATA_DIR_SYNC_METHOD_FSYNC;
bool data_only = false;
bool schema_only = false;
- bool statistics_only = false;
+ static int statistics_only = 0;
bool with_statistics = false;
bool no_data = false;
bool no_schema = false;
@@ -513,7 +513,7 @@ main(int argc, char **argv)
{"serializable-deferrable", no_argument,
&dopt.serializable_deferrable, 1},
{"snapshot", required_argument, NULL, 6},
{"statistics", no_argument, NULL, 22},
- {"statistics-only", no_argument, NULL, 18},
+ {"statistics-only", no_argument, &statistics_only, 1},
{"strict-names", no_argument, &strict_names, 1},
{"use-set-session-authorization", no_argument,
&dopt.use_setsessauth, 1},
{"no-comments", no_argument, &dopt.no_comments, 1},
@@ -777,10 +777,6 @@ main(int argc, char **argv)
optarg);
break;
- case 18:
- statistics_only = true;
- break;
-
case 19:
no_data = true;
break;
---------------------------------------
We could apply the same pattern to others like no_data, no_schema,
no_statistics, and with_statistics to make the code cleaner and more
consistent across tools.
Regards,
--
Fujii Masao