Re: Support EXCEPT for ALL SEQUENCES publications

From: Peter Smith <smithpb2250(at)gmail(dot)com>
To: Shlok Kyal <shlok(dot)kyal(dot)oss(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, vignesh C <vignesh21(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Support EXCEPT for ALL SEQUENCES publications
Date: 2026-06-22 21:03:27
Message-ID: CAHut+PsmHJDNUpEqcW+5JXwc7+ci=DGqBvyT+pNTwYnJ=1B8fA@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi Shlok.

FYI, I tested that the exclusion of a SEQUENCE follows the sequence
object around the same as a table excluded from FOR ALL TABLES does.

> 1.
> The recent commit 77b6dd9 added some more information to say:
>
> ---
> Once a table is excluded, the exclusion applies to that table
> regardless of its name or schema. Renaming the table or moving it to
> another schema using <command>ALTER TABLE ... SET SCHEMA</command> does
> not remove the exclusion.
> ---
>
> 1a
> AFAIK this same rule (the exclusion follows the object regardless of
> the schema) is going to apply also for excluding sequences. So, the
> docs should be updated to say something similar about behaviour for
> sequences.
>
> ~
>
> 1b.
> Maybe you need to add another test case to exclude some sequence, then
> alter the sequence's schema, then verify that the moved sequence is
> still excluded.
>

test_pub=# CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT (TABLE
PUBT1), ALL SEQUENCES EXCEPT (SEQUENCE PUBSEQ);
CREATE PUBLICATION

test_pub=# \dRp+ pub1
Publication pub1
Owner | All tables | All sequences | Inserts | Updates | Deletes |
Truncates | Generated columns | Via root | Descri
ption
----------+------------+---------------+---------+---------+---------+-----------+-------------------+----------+-------
------
postgres | t | t | t | t | t |
t | none | f |
Except tables:
"public.pubt1"
Except sequences:
"public.pubseq"

-- Now move the excluded sequence to another schema and see that it is
still excluded

test_pub=# alter sequence pubseq set schema myschema;
ALTER SEQUENCE
test_pub=# \dRp+ pub1
Publication pub1
Owner | All tables | All sequences | Inserts | Updates | Deletes |
Truncates | Generated columns | Via root | Descri
ption
----------+------------+---------------+---------+---------+---------+-----------+-------------------+----------+-------
------
postgres | t | t | t | t | t |
t | none | f |
Except tables:
"public.pubt1"
Except sequences:
"myschema.pubseq"

-- Now rename the excluded sequence and see that it is still excluded

test_pub=# alter sequence myschema.pubseq rename to pubseq2;
ALTER SEQUENCE
test_pub=# \dRp+ pub1
Publication pub1
Owner | All tables | All sequences | Inserts | Updates | Deletes |
Truncates | Generated columns | Via root | Descri
ption
----------+------------+---------------+---------+---------+---------+-----------+-------------------+----------+-------
------
postgres | t | t | t | t | t |
t | none | f |
Except tables:
"public.pubt1"
Except sequences:
"myschema.pubseq2"

======
Kind Regards,
Peter Smith.
Fujitsu Australia

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jeff Davis 2026-06-22 21:10:25 Re: Bug in ALTER SUBSCRIPTION ... SERVER / ... CONNECTION with broken old server
Previous Message Jacob Champion 2026-06-22 20:50:37 Re: PG20 Minimum Dependency Thread