From: | Shubham Khanna <khannashubham1197(at)gmail(dot)com> |
---|---|
To: | "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com> |
Cc: | vignesh C <vignesh21(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Euler Taveira <euler(at)eulerto(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility. |
Date: | 2025-03-19 08:32:29 |
Message-ID: | CAHv8RjKRLn5P_jQ8gnO5u95NRBAwoVMr9UHQ8vN-tjT2jPxuWg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Mar 19, 2025 at 12:44 PM Zhijie Hou (Fujitsu)
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Wed, Mar 19, 2025 at 2:55 PM Shubham Khanna wrote:
> >
> > I have merged the changes and prepared the latest patch. The attached
> > patch contains the suggested changes.
>
> Thanks for updating the patch. Here are few comments:
>
Thank you for the suggestions. I agree with the changes you have attached.
> 1.
> pg_log_error("object type \"%s\" is specified more than once for --remove", optarg);
> exit(1);
>
> Consider using pg_fatal for simplicity.
>
Replacing pg_log_error with pg_fatal makes the error handling more consistent.
>
> 2.
>
> + /* Fetch all publication names */
> + res = PQexec(conn, "SELECT pubname FROM pg_catalog.pg_publication;");
> + if (PQresultStatus(res) != PGRES_TUPLES_OK)
> + {
> + pg_log_error("could not obtain publication information: %s",
> + PQresultErrorMessage(res));
> + PQclear(res);
> + disconnect_database(conn, false);
> + return;
> + }
>
> I think we should exit here for consistency, as performed in similar cases.
>
Exiting on failure when fetching publication names improves
consistency with similar cases.
>
> 3.
>
> + pg_log_info("dropped all publications in database \"%s\"", dbinfo->dbname);
>
> This message may be misleading if some publications were not dropped
> successfully, as drop_publication does not exit on a drop failure.
>
Updating the log message to reflect partial drop failures avoids
misleading information.
> 4.
>
> if (opt.remove_objects.head != NULL)
> {
> for (SimpleStringListCell *cell = opt.remove_objects.head; cell; cell = cell->next)
> {
>
> I think the first null test is redundant.
>
> I have attached a patch with the proposed changes. If you agree with these
> modifications, please merge them.
>
Removing the redundant NULL check simplifies the logic.
I have merged the changes and prepared the latest patch. The attached
patch contains the suggested changes.
Thanks and regards,
Shubham Khanna.
Attachment | Content-Type | Size |
---|---|---|
v22-0001-Support-for-dropping-all-publications-in-pg_crea.patch | application/octet-stream | 12.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Amit Kapila | 2025-03-19 08:44:09 | Re: Adding a '--clean-publisher-objects' option to 'pg_createsubscriber' utility. |
Previous Message | vignesh C | 2025-03-19 08:25:19 | Re: Add missing tab completion for VACUUM and ANALYZE with ONLY option |