Re: Add support for specifying tables in pg_createsubscriber.

From: Shubham Khanna <khannashubham1197(at)gmail(dot)com>
To: Peter Smith <smithpb2250(at)gmail(dot)com>
Cc: Chao Li <li(dot)evan(dot)chao(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Add support for specifying tables in pg_createsubscriber.
Date: 2025-11-05 04:41:47
Message-ID: CAHv8RjLNbivikA6zFZ_YM4tqeauu_sNR80z_LDx_TSN_TejQig@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Nov 3, 2025 at 12:55 PM Peter Smith <smithpb2250(at)gmail(dot)com> wrote:
>
> Hi Shubham.
>
> A comment about the v17-0001.
>
> ======
> 1.
> + if (check_publication_exists(conn, dbinfo[i].pubname, dbinfo[i].dbname))
> + {
> + /* Reuse existing publication on publisher. */
> + pg_log_info("dry-run: would use existing publication \"%s\" in
> database \"%s\"",
> + dbinfo[i].pubname, dbinfo[i].dbname);
> + dbinfo[i].made_publication = false;
> + }
>
> Is that correct? Won't this code now unconditionally log with the
> "dry-run:" prefix, even when the tool is *not* doing a dry-run?
>
> I thought code would be something like:
>
> SUGGESTION #1 (if/else)
> /* Reuse existing publication on publisher. */
> if (dry_run)
> pg_log_info("dry-run: would use existing publication ...);
> else
> pg_log_info("use existing publication ...);
>
> ~~~
>
> OTOH, (since here is just an info message with no destructive
> operation) perhaps it would be harmless also to keep the original log
> message for both dry-run and normal mode.
>
> SUGGESTION #2 (do nothing)
> pg_log_info("use existing publication ...);
>
> ======

Hi Peter,

Thank you for your review and suggestions.
I agree with your reasoning regarding the logging behavior. I will
proceed with Suggestion #2 and retain the existing `pg_log_info("use
existing publication ...");` message for both dry-run and normal
modes. This message is purely informational and does not perform any
destructive action, making it suitable for both scenarios.
The attached patch includes these changes.

Thanks and regards,
Shubham Khanna.

Attachment Content-Type Size
v18-0001-Support-existing-publications-in-pg_createsubscr.patch application/octet-stream 12.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Fujii Masao 2025-11-05 04:44:03 Re: DOCS: ALTER PUBLICATION - Synopsis for DROP is a bit misleading
Previous Message Fujii Masao 2025-11-05 04:33:52 Re: [PATCH] Add archive_mode=follow_primary to prevent unarchived WAL on standby promotion