Re: Skipping schema changes in publication

vignesh C <vignesh21@gmail.com>

From: vignesh C <vignesh21@gmail.com>
To: Peter Smith <smithpb2250@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Shlok Kyal <shlok.kyal.oss@gmail.com>, Dilip Kumar <dilipbalaut@gmail.com>, shveta malik <shveta.malik@gmail.com>, Masahiko Sawada <sawada.mshk@gmail.com>, "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>, Nisha Moond <nisha.moond412@gmail.com>, Ashutosh Sharma <ashu.coek88@gmail.com>, "David G. Johnston" <david.g.johnston@gmail.com>, "Zhijie Hou (Fujitsu)" <houzj.fnst@fujitsu.com>, YeXiu <1518981153@qq.com>, Ian Lawrence Barwick <barwick@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-04-20T12:13:15Z
Lists: pgsql-hackers

Attachments

Hi,

When changing a table to UNLOGGED, tables that appear in publications
via EXCEPT clauses (prexcept = true) are currently allowed, but their
entries remain in pg_publication_rel.

For example:
postgres=# create table t1(c1 int);
CREATE TABLE
postgres=# create publication pub1 for all tables except (table t1);
CREATE PUBLICATION
postgres=# alter table t1 set unlogged;
ALTER TABLE
postgres=# \d t1
            Unlogged table "public.t1"
 Column |  Type   | Collation | Nullable | Default
--------+---------+-----------+----------+---------
 c1     | integer |           |          |
Except publications:
    "pub1"

Since UNLOGGED tables are not supported in publications, this leaves
stale catalog entries. This patch removes such entries from
pg_publication_rel when the table is changed to UNLOGGED, and emits a
NOTICE to inform the user.

Another option considered was to throw an error when setting such
tables to UNLOGGED. However, allowing the operation was preferred,
since UNLOGGED tables do not generate WAL and are not replicated
anyway, so blocking the operation would be unnecessarily restrictive.

Attached patch has the changes for the same.

Thoughts?

Regards,
Vignesh

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Fix miscellaneous issues in EXCEPT publication clause.

  2. Change syntax of EXCEPT TABLE clause in publication commands.

  3. Add support for EXCEPT TABLE in ALTER PUBLICATION.

  4. Allow table exclusions in publications via EXCEPT TABLE.

  5. Add wait_for_subscription_sync for TAP tests.