From: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com> |
---|---|
To: | Shubham Khanna <khannashubham1197(at)gmail(dot)com> |
Cc: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com> |
Subject: | RE: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided. |
Date: | 2025-02-18 09:13:38 |
Message-ID: | OS0PR01MB571616455E4606AAD987047F94FA2@OS0PR01MB5716.jpnprd01.prod.outlook.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thursday, February 13, 2025 11:28 AM Shubham Khanna <khannashubham1197(at)gmail(dot)com> wrote:
Hi,
> The attached patch contains the required changes.
Thanks for updating the patch. I think it's a useful feature.
Here are few review comments:
1.
+ if (opt.all_databases)
+ {
+ pg_log_error("--all-databases specified multiple times");
+ exit(1);
+ }
The check for redundant --all-databases usage seems unnecessary as multiple
specifications do not cause harm or confusion for users. Similar server
commands with an --all option (such as clusterdb/vacuumdb/reindexdb) do not
report errors for it.
2.
+ while ((c = getopt_long(argc, argv, "ad:D:np:P:s:t:U:v",
long_options, &option_index)) != -1)
...
+ if (num_dbs > 0)
+ {
+ pg_log_error("--all-databases cannot be used with --database");
+ exit(1);
+ }
I think the check for similar wrong combinations should not be done inside the
getopt_long() block. It should be performed after parsing to ensure all
cases are handled which would also be consistent with the methodology followed in
all other commands AFAICS.
Maybe we can write the error message in the format "%s cannot be used with %s"
to reduce the translation workload.
To be consistent with other error message for wrong option specification in this
command, consider adding pg_log_error_hint("Try \"%s --help\" for more information.").
3.
Ashutosh noted that commands like clusterdb and vacuumdb use the "--all" option
to indicate all databases, and I also found that the same is true for
pg_amcheck command, so I also think it's OK to use "-all" here.
Best Regards,
Hou zj
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2025-02-18 09:15:33 | Re: Enhance 'pg_createsubscriber' to retrieve databases automatically when no database is provided. |
Previous Message | vignesh C | 2025-02-18 09:12:44 | Commitfest Manager for March |