Re: pg_dump --with-* options
От | Fujii Masao |
---|---|
Тема | Re: pg_dump --with-* options |
Дата | |
Msg-id | CAHGQGwF3YcYEWuy+76t87R4jR43_gzmRr34rRPNWfCs9yGR=xA@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: pg_dump --with-* options (Jeff Davis <pgsql@j-davis.com>) |
Ответы |
Re: pg_dump --with-* options
|
Список | pgsql-hackers |
On Sat, Aug 2, 2025 at 4:42 AM Jeff Davis <pgsql@j-davis.com> 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
В списке pgsql-hackers по дате отправления: