Re: Skipping schema changes in publication - Mailing list pgsql-hackers

From vignesh C
Subject Re: Skipping schema changes in publication
Date
Msg-id CALDaNm2VghC-CSyS6jwyMMcpwSWjQ09t9AkkL0Sz7dsb1VGF3A@mail.gmail.com
Whole thread
In response to Re: Skipping schema changes in publication  (Peter Smith <smithpb2250@gmail.com>)
List pgsql-hackers
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

Attachment

pgsql-hackers by date:

Previous
From: Nisha Moond
Date:
Subject: Re: Proposal: Conflict log history table for Logical Replication
Next
From: Fujii Masao
Date:
Subject: Re: Cleanup: Use modern macro for text-to-CString conversion in plsample.c