Re: Skipping schema changes in publication

From: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
To: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, YeXiu <1518981153(at)qq(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Skipping schema changes in publication
Date: 2026-02-12 06:58:28
Message-ID: CANhcyEVB6XkVQ4YYN3x+P5NeG=tOWg-OWebGiqMp02XXMVUa6A@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 11 Feb 2026 at 11:32, David G. Johnston
<david(dot)g(dot)johnston(at)gmail(dot)com> wrote:
>
> On Tuesday, February 10, 2026, shveta malik <shveta(dot)malik(at)gmail(dot)com> wrote:
>>
>> >
>> > The attached v42 version patch has the changes for the same.
>> >
>>
>> Thanks, will review.
>
>
> Publication names are unique within the database. In check_publications_except_list, the use of “select distinct” when pulling from pg_publication by name is unnecessary. Furthermore, if we only have a single publication name it is unnecessary to perform the check and thus no need to even run the query.
>
> David J.
>
>
> +check_publications_except_list(WalReceiverConn *wrconn, List *publications)
> +{
> + WalRcvExecResult *res;
> + StringInfoData cmd;
> + TupleTableSlot *slot;
> + Oid tableRow[1] = {TEXTOID};
> + List *except_publications = NIL;
> +
> + initStringInfo(&cmd);
> + appendStringInfoString(&cmd,
> + "SELECT DISTINCT p.pubname\n"
> + " FROM pg_catalog.pg_publication p\n"
> + " WHERE p.pubname IN (");
> +
> + GetPublicationsStr(publications, &cmd, true);
> +
> + appendStringInfoString(&cmd,
> + ")\n"
> + " AND EXISTS (SELECT 1\n"
> + " FROM pg_catalog.pg_publication_rel pr\n"
> + " WHERE pr.prpubid = p.oid\n"
> + " AND pr.prexcept IS TRUE)");

Hi David,

We have addressed the comments in the latest v43 patch.
Also we have refactored the code in
'pg_get_publication_effective_tables' and added comments to make it
simpler to understand.

Thanks,
Shlok Kyal

Attachment Content-Type Size
v43-0002-Extended-tests-for-EXCEPT-TABLE-patch.patch application/octet-stream 4.9 KB
v43-0001-Skip-publishing-the-tables-specified-in-EXCEPT-T.patch application/octet-stream 101.8 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Pyhalov 2026-02-12 07:08:45 Re: Asynchronous MergeAppend
Previous Message Andrey Borodin 2026-02-12 06:56:10 Re: Streaming replication and WAL archive interactions