Re: BUG #18644: ALTER PUBLICATION ... SET (publish_via_partition_root) wrong/undocumented behavior.

From: vignesh C <vignesh21(at)gmail(dot)com>
To: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
Cc: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>
Subject: Re: BUG #18644: ALTER PUBLICATION ... SET (publish_via_partition_root) wrong/undocumented behavior.
Date: 2024-10-09 10:44:31
Message-ID: CALDaNm3yWCY+q60OremzicPRZWrYZRg22a=KcfBmAyVud4H2FQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, 9 Oct 2024 at 11:01, Hayato Kuroda (Fujitsu)
<kuroda(dot)hayato(at)fujitsu(dot)com> wrote:
>
> Dear Maxim, Amit,
>
> > Thank you, it should be work. Unfortunately my English writing now is
> > not good enough to suggest correct and easy to understand warnings in
> > the documentation about this issue.
>
> I've written a doc patch to add a caution in ALTER PUBLICATION page. How do you feel?

Few comments:
1) How about changing:
+ <para>
+ Altering the <literal>publish_via_partition_root</literal> during the
+ replication can lead to data loss or duplication. This is because the
+ publisher replicates changes as the partitioned table after the
+ altering, but it is not listed in
+ <link linkend="catalog-pg-subscription-rel"><literal>pg_subscription_rel</literal></link>.
+ </para>

to:
When the partition root table is specified as the replication target
instead of its leaf tables, changing the publish_via_partition_root
parameter during replication can cause data loss or duplication. This
happens because the subscriber initially subscribed to the leaf
tables. After running the ALTER PUBLICATION ... SET and ALTER
SUBSCRIPTION ... REFRESH PUBLICATION command, the subscriber will
subscribe to the partition root table.

2) Should we change:
+ To prevent the issue, you can avoid modifying the partitioned table
+ between the <command>ALTER PUBLICATION ... SET</command> and
+ <link linkend="sql-altersubscription"><command>ALTER
SUBSCRIPTION ... REFRESH PUBLICATION</command></link>.

to:
+ To prevent the issue, you can avoid modifying the partitioned table
+ between the <command>ALTER PUBLICATION ... SET</command> and
+ <link linkend="sql-altersubscription"><command>ALTER
SUBSCRIPTION ... REFRESH PUBLICATION</command></link> and refresh
publication with copy_data as off.

Regards,
Vignesh

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Todd Brandys 2024-10-09 12:26:05 Re: BUG #18647: INSERT statements execute functions twice.
Previous Message Bing Xu 2024-10-09 09:17:24 RE: BUG #18635: " $libdir/adminpack could not be loaded" error with pg_upgrade to PostgreSQL17