RE: Skipping schema changes in publication

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'Masahiko Sawada' <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Ashutosh Sharma <ashu(dot)coek88(at)gmail(dot)com>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Peter Smith <smithpb2250(at)gmail(dot)com>, "Zhijie Hou (Fujitsu)" <houzj(dot)fnst(at)fujitsu(dot)com>, YeXiu <1518981153(at)qq(dot)com>, Ian Lawrence Barwick <barwick(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: RE: Skipping schema changes in publication
Date: 2026-03-12 11:50:39
Message-ID: OS9PR01MB12149EA0C749BC29C7C949E32F544A@OS9PR01MB12149.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Dear Sawada-san,

> I'm still unsure that the syntax like TABLE (t1, t2) for the exclusion
> list is syntactically correct. The syntax of TABLE (...) is already
> used in a quite different way as follows (borrowed an example from
> stats_import.sql):
>
> CREATE FUNCTION stats_import.pg_statistic_get_difference(a text, b text)
> RETURNS TABLE (relname text, stats stats_import.pg_statistic_flat_t)
> BEGIN ATOMIC
> WITH aset AS (SELECT * FROM stats_import.pg_statistic_flat(a)),
> bset AS (SELECT * FROM stats_import.pg_statistic_flat(b))
> SELECT a AS relname, a_minus_b::stats_import.pg_statistic_flat_t
> FROM (TABLE aset EXCEPT TABLE bset) AS a_minus_b
> UNION ALL
> SELECT b AS relname, b_minus_a::stats_import.pg_statistic_flat_t
> FROM (TABLE bset EXCEPT TABLE aset) AS b_minus_a;
> END;
>
> Wouldn't it be more appropriate to use a plural form or the IN
> keyword, such as EXCEPT TABLES (t1, t2) or EXCEPT TABLES IN (t1, t2)?

But there is an existing syntax to list target tables, FOR TABLE t1, t2, t3...,
which does not have the plural. Current rule is to use the singular for
specifying the exact table, and we follow.

> Or if we might want to add multiple items in the EXCEPT clause in the
> future we can have parentheses around all exclusion items as follow:
>
> CREATE PUBLICATION pub FOR ALL TABLES EXCEPT (TABLE t1, TABLE t2,
> TABLES IN SCHEMA s1);
> CREATE PUBLICATION pub FOR TABLES IN SCHEMA s1 EXCEPT (TABLE t1,
> TABLE
> t2), TABLE t3;

I agree those alternatives could work, but one downside is the redundant use of
"TABLE" when many tables are excluded. If we want to stay consistent with the
existing style, perhaps we could write it as:

```
CREATE PUBLICATION pub FOR ALL TABLES EXCPET (TABLE t1, t2, t3);
```

Because we have already been accepting the syntax like "FOR TABLE t1, t2, t3".

Best regards,
Hayato Kuroda
FUJITSU LIMITED

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrei Lepikhov 2026-03-12 12:02:24 Re: Vacuum statistics
Previous Message Yura Sokolov 2026-03-12 11:25:17 Re: Why clearing the VM doesn't require registering vm buffer in wal record