| From: | Amit Kapila <akapila(at)postgresql(dot)org> |
|---|---|
| To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
| Subject: | pgsql: Fix assorted issues in conflict log table handling. |
| Date: | 2026-11-26 05:52:37 |
| Message-ID: | E1xWSPN-00000000MKD-08Dm@gemulon.postgresql.org |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-committers |
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(dot)parragi(at)percona(dot)com>
Author: Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>
Author: Dilip Kumar <dilipkumarb(at)google(dot)com>
Reviewed-by: shveta malik <shveta(dot)malik(at)gmail(dot)com>
Reviewed-by: vignesh C <vignesh21(at)gmail(dot)com>
Reviewed-by: Hayato Kuroda <kuroda(dot)hayato(at)fujitsu(dot)com>
Reviewed-by: Zhijie Hou <houzhijie22(at)gmail(dot)com>
Reviewed-by: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Reviewed-by: Peter Smith <smithpb2250(at)gmail(dot)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(-)
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Heikki Linnakangas | 2026-11-26 08:06:23 | pgsql: Use logical OR (||) rather than bitwise OR (|) for bools |
| Previous Message | David Rowley | 2026-11-26 04:56:03 | pgsql: Speedup pg_strtok() with a static lookup table |