On Sat, 27 Sept 2025 at 01:20, Shlok Kyal <shlok.kyal.oss@gmail.com> wrote:
>
> Thanks for reviewing the patch.
> I have addressed the comments and attached the updated version.
If all columns are excluded, we do not publish the changes. However,
when a table has no columns, the data is still replicated. Should we
make this behavior consistent?
@@ -1482,6 +1525,13 @@ pgoutput_change(LogicalDecodingContext *ctx,
ReorderBufferTXN *txn,
relentry = get_rel_sync_entry(data, relation);
+ /*
+ * If all columns of a table are present in column list specified with
+ * EXCEPT, skip publishing the changes.
+ */
+ if (relentry->all_cols_excluded)
+ return;
Steps to check the above issue:
-- pub
create table t1();
create table t2(c1 int, c2 int);
create publication pub1 FOR table t1;
create publication pub2 FOR table t2 except(c1, c2);
--sub
create table t1(c1 int);
create table t2(c1 int, c2 int);
create subscription sub1 connection 'dbname=postgres host=localhost
port=5432' publication pub1,pub2;
--pub
postgres=# insert into t1 default values ;
INSERT 0 1
postgres=# insert into t2 default values;
INSERT 0 1
--sub
-- In case of table having no columns, data is replicated
postgres=# select * from t1;
c1
----
(1 row)
-- In case of table having all columns excluded, data is not replicated
postgres=# select * from t2;
c1 | c2
----+----
(0 rows)
Thoughts?
Regards,
Vignesh