Re: Add support for specifying tables in pg_createsubscriber.
Chao Li <li.evan.chao@gmail.com>
From: Chao Li <li.evan.chao@gmail.com>
To: Shubham Khanna <khannashubham1197@gmail.com>
Cc: Peter Smith <smithpb2250@gmail.com>,
"Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>,
vignesh C <vignesh21@gmail.com>,
"Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-09-25T07:45:26Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Support existing publications in pg_createsubscriber.
- 85ddcc2f4cde 19 (unreleased) landed
> On Sep 25, 2025, at 15:07, Shubham Khanna <khannashubham1197@gmail.com> wrote:
>>
>>
>> 1.
>> ```
>> + if (dbinfo->made_publication)
>> + drop_publication(conn, dbinfo->pubname, dbinfo->dbname,
>> + &dbinfo->made_publication);
>> + else
>> + pg_log_info("preserve existing publication \"%s\" in database \"%s\"",
>> + dbinfo->pubname, dbinfo->dbname);
>> + }
>> ```
>>
>> Should we preserve “|| dry_run”? Because based on the old comment, in dry-run mode, even if we don’t create publications, we still want to inform the user.
>>
>
> We don’t need to add an explicit "|| dry_run" here, since the
> made_publication flag already accounts for that case. In dry-run mode,
> no publications are actually created, so made_publication is never
> set. This ensures we still hit the “preserve existing publication …”
> branch and inform the user accordingly.
>
I doubt that. Looking the code in create_publication():
if (!dry_run)
{
res = PQexec(conn, str->data);
if (PQresultStatus(res) != PGRES_COMMAND_OK)
{
pg_log_error("could not create publication \"%s\" in database \"%s\": %s",
dbinfo->pubname, dbinfo->dbname, PQresultErrorMessage(res));
disconnect_database(conn, true);
}
PQclear(res);
}
/* For cleanup purposes */
dbinfo->made_publication = true;
made_publication will always be set regardless of dry_run.
Best regards,
--
Chao Li (Evan)
HighGo Software Co., Ltd.
https://www.highgo.com/