Re: Skipping schema changes in publication

Amit Kapila <amit.kapila16@gmail.com>

From: Amit Kapila <amit.kapila16@gmail.com>
To: Peter Smith <smithpb2250@gmail.com>
Cc: vignesh C <vignesh21@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-03-31T03:55:31Z
Lists: pgsql-hackers
On Tue, Mar 31, 2026 at 6:00 AM Peter Smith <smithpb2250@gmail.com> wrote:
>
> Hi Vignesh.
>
> Some review comments for patch v4-0001.
>
> ======
> doc/src/sgml/ref/alter_publication.sgml
>
> 1.
> -    [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ *
]
> +    TABLE <replaceable class="parameter">table_object</replaceable> [,
... ]
> +
> +<phrase>and <replaceable class="parameter">table_object</replaceable>
> is:</phrase>
> +
> +   [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
>
> With the introduction of 'table_object' I expected that
> 'table_and_columns' and 'publication_drop_object' would also make use
> of it. Why not?
>
> ======
> doc/src/sgml/ref/create_publication.sgml
>
> 2.
> -    [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ *
]
> +    TABLE <replaceable class="parameter">table_object</replaceable> [,
... ]
> +
> +<phrase>and <replaceable class="parameter">table_object</replaceable>
> is:</phrase>
> +
> +   [ ONLY ] <replaceable class="parameter">table_name</replaceable> [ * ]
>
> With the introduction of 'table_object' I expected that
> 'table_and_columns' would also make use of it. Why not?
>

These sound like worth considering but let's do them as a separate patch,
otherwise, the main patch may take more time.

>
> ======
> src/backend/parser/gram.y
>
> 3.
> @@ -11399,7 +11399,7 @@ pub_obj_list: PublicationObjSpec
>   ;
>
>  opt_pub_except_clause:
> - EXCEPT TABLE '(' pub_except_obj_list ')' { $$ = $4; }
> + EXCEPT '(' TABLE pub_except_obj_list ')' { $$ = $4; }
>   | /*EMPTY*/ { $$ = NIL; }
>   ;
>
> @@ -11439,8 +11439,8 @@ PublicationExceptObjSpec:
>
>  pub_except_obj_list: PublicationExceptObjSpec
>   { $$ = list_make1($1); }
> - | pub_except_obj_list ',' PublicationExceptObjSpec
> - { $$ = lappend($1, $3); }
> + | pub_except_obj_list ',' opt_table PublicationExceptObjSpec
> + { $$ = lappend($1, $4); }
>   ;
>
> IMO we should put 'table' in all those table-specific production names:
> e.g. opt_pub_except_clause ==> opt_pub_except_table_clause
> e.g. pub_except_obj_list ==> pub_except_tableobj_list
> e.g. PublicationExceptObjSpec ==> PublicationExceptTableObjSpec
>
> IIUC, in future when "FOR ALL SEQUENCES EXCEPT (SEQUENCES ...)" and/or
> "FOR ALL SCHEMAS EXCEPT (SCHEMA ...)" are implemented then these names
> won't be much good anymore, so I thought they should be made
> table-specific now to avoid churning them later.

I think if/when we need to further extend this feature, we need to go back
to the previous approach of using something akin to the
preprocess_pub_all_objtype_list() kind of function. Consider when we need
to support EXCEPT (TABLES IN SCHEMA s1, TABLE t1) kind of cases, the
current code may or may not be the best way to realize it. So, I think for
now we can leave discussion on this to future extensions of this feature.

--
With Regards,
Amit Kapila.

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.