pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Amit Kapila <akapila@postgresql.org>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix assorted issues in conflict log table handling.
Date: Thu, 26 Nov 2026 05:52:37 +0000
Message-ID: <E1xWSPN-00000000MKD-08Dm@gemulon.postgresql.org> (raw)

Fix assorted issues in conflict log table handling.

DROP SUBSCRIPTION and ALTER SUBSCRIPTION ... SET
(conflict_log_destination = 'log') dropped the conflict log table with
DROP_CASCADE since a5918fddf1, so user objects depending on the table or
its row type, such as views or functions, were dropped silently. Those
objects need not be owned by the subscription owner, and for ALTER the
effect is surprising because it looks like a mere logging setting change.

Now DROP SUBSCRIPTION passes its CASCADE | RESTRICT behavior down to the
deletion of the table, and ALTER SUBSCRIPTION always uses RESTRICT, so
both fail when other objects depend on the table, as DROP TABLE does. In
DROP SUBSCRIPTION the table is now dropped after the workers are stopped
and the prepared-transaction check, but before the tablesync origins are
dropped, because dropping an origin resets its progress in shared memory
and that is not undone on rollback.

Also document the pg_subscription columns subconflictlogrelid and
subconflictlogdest in catalogs.sgml, and explain once, above
IsConflictLogTableNamespace(), why operations on conflict log tables are
restricted, instead of repeating it at each call site.

Author: Zsolt Parragi <zsolt.parragi@percona.com>
Author: Nisha Moond <nisha.moond412@gmail.com>
Author: Dilip Kumar <dilipkumarb@google.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: vignesh C <vignesh21@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Reviewed-by: Zhijie Hou <houzhijie22@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Peter Smith <smithpb2250@gmail.com>
Discussion: https://postgr.es/m/CAFiTN-sHeA%3DA%2B054KcOGue_q4tiT65rRvKxfdmJL3xjMwa2Kow%40mail.gmail.com
Discussion: https://postgr.es/m/CAN4CZFOqiZtHOHAgd1mA325XQrsShj0C%3DvK2SBboUTFEmdoPZg%40mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b8bf28800559a9ad71360fb2384d4b9981d24fa8

Modified Files
--------------
doc/src/sgml/catalogs.sgml                 | 26 +++++++++++
doc/src/sgml/ddl.sgml                      |  2 +-
doc/src/sgml/ref/alter_subscription.sgml   |  3 +-
doc/src/sgml/ref/drop_subscription.sgml    | 15 +++++--
src/backend/catalog/catalog.c              | 13 +++++-
src/backend/commands/policy.c              |  5 ---
src/backend/commands/subscriptioncmds.c    | 72 +++++++++++++++++++++++-------
src/backend/commands/tablecmds.c           | 20 ---------
src/backend/commands/trigger.c             | 10 -----
src/backend/replication/logical/conflict.c |  8 +++-
src/backend/rewrite/rewriteDefine.c        | 10 -----
src/test/regress/expected/subscription.out | 18 +++++++-
src/test/regress/sql/subscription.sql      | 11 ++++-
13 files changed, 141 insertions(+), 72 deletions(-)



Message-ID: <E1xWSPN-00000000MKD-08Dm@gemulon.postgresql.org>
Permalink:  ../E1xWSPN-00000000MKD-08Dm@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1xWSPN-00000000MKD-08Dm@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: akapila@postgresql.org
  Subject: Re: pgsql: Fix assorted issues in conflict log table handling.
  In-Reply-To: <E1xWSPN-00000000MKD-08Dm@gemulon.postgresql.org>
  References: <E1xWSPN-00000000MKD-08Dm@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox