| From: | shveta malik <shveta(dot)malik(at)gmail(dot)com> |
|---|---|
| To: | vignesh C <vignesh21(at)gmail(dot)com> |
| Cc: | Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com> |
| Subject: | Re: Support EXCEPT for ALL SEQUENCES publications |
| Date: | 2026-04-10 10:06:29 |
| Message-ID: | CAJpy0uDU0PrH=gvFZjpphOX7t=2jH5wTqYry=C22vnuJJ9Q5=g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Fri, Apr 10, 2026 at 11:59 AM vignesh C <vignesh21(at)gmail(dot)com> wrote:
>
> On Fri, 10 Apr 2026 at 11:39, Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com> wrote:
> >
> > Hi hackers,
> >
> > Thread [1] introduced support for the EXCEPT clause for publications
> > defined with ALL TABLES. To extend this functionality, as discussed in
> > [2], this patch series adds support for the EXCEPT clause for
> > publications defined with ALL SEQUENCES.
> >
> > The series consists of the following patches:
> >
> > 0001: Support EXCEPT for ALL SEQUENCES in CREATE PUBLICATION
> > This allows excluding specific sequences when using CREATE PUBLICATION
> > ... FOR ALL SEQUENCES.
> > Example:
> > CREATE PUBLICATION pub1 FOR ALL SEQUENCES EXCEPT (SEQUENCE s1, s2);
> >
> > 0002: Support EXCEPT for ALL SEQUENCES in ALTER PUBLICATION
> > This extends ALTER PUBLICATION to manage exclusions for ALL SEQUENCES.
> > Examples:
> > ALTER PUBLICATION pub1 SET ALL SEQUENCES;
> > This clears any existing sequence exclusions.
> >
> > ALTER PUBLICATION pub1 SET ALL SEQUENCES EXCEPT (SEQUENCE s1, s2);
> > This replaces the exclusion list with the specified sequences.
> >
> > Sequences listed in the EXCEPT clause are excluded from the
> > publication and are not replicated to the subscriber.
>
> +1 for this feature.
>
> Currently, FOR ALL SEQUENCES is effectively an all-or-nothing choice.
> In practice, there are often specific sequences, such as temporary or
> locally managed ones, that do not need to be replicated. With this
> change, those can now be excluded cleanly.
>
+1 on the idea. The use cases will be such temproary or short
duration sequences (created for temp purpose but persisted ones) which
are node specific and may not require replication to replica node.
I have not finished full review yet, but few comments on 001:
1)
postgres=# create unlogged sequence seq4;
CREATE SEQUENCE
postgres=# create publication pub9 for all sequences EXCEPT ( SEQUENCE seq4);
ERROR: cannot specify relation "seq4" in the publication EXCEPT clause
DETAIL: This operation is not supported for unlogged tables.
Detail need to be corrected. Same for temporary sequence.
2)
/*
* Add or remove table to/from publication.
*/
AlterPublicationTables
This function is now called even to add sequence in except-clause.
Shall we change the name and comment?
3)
CreatePublication():
+ if (stmt->for_all_sequences && exceptseqs != NIL)
+ {
+ List *rels;
+ /* Process EXCEPT sequence list */
+ rels = OpenRelationList(exceptseqs);
+ PublicationAddRelations(puboid, rels, true, NULL, RELKIND_SEQUENCE);
+ CloseRelationList(rels);
+ }
if (stmt->for_all_tables)
We can have a blank line in between.
4)
Below comment in getPublications() need update to incoporate sequence
in full comment.
* Get the list of tables for publications specified in the EXCEPT
* TABLE clause.
*
* Although individual table entries in EXCEPT list could be stored in
...
thanks
Shveta
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Amit Kapila | 2026-04-10 10:19:34 | Re: EXCEPT TABLE - Case inconsistency for describe \d and \dRp+ |
| Previous Message | cca5507 | 2026-04-10 09:57:39 | [BUG] Take a long time to reach consistent after pg_rewind |