agora inbox for pgsql-committers@postgresql.org  
help / color / mirror / Atom feed
pgsql: Validate ALTER PUBLICATION after acquiring the publication lock.
2+ messages / 1 participants
[nested] [flat]

* pgsql: Validate ALTER PUBLICATION after acquiring the publication lock.
@ 2026-09-11 04:27 Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Kapila @ 2026-09-11 04:27 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Validate ALTER PUBLICATION after acquiring the publication lock.

AlterPublicationOptions() can use stale publication state when the
publication is modified concurrently while waiting for the publication
lock. In particular, a concurrent ALTER PUBLICATION ... SET ALL TABLES
can change puballtables, causing the validation to make decisions based
on the old value and leads to assertion failure. Likewise,
CheckAlterPublication() could miss a table added concurrently, letting
SET ALL TABLES EXCEPT (...) leave pg_publication_rel with a mixture of
inclusion and exclusion rows.

Fix by acquiring the lock and re-reading the publication tuple in
AlterPublication() before either path runs, and by calling
CheckAlterPublication() only after that.

Also fix 037_except.pl, which left one computed result untested and
silently reused a subscription created by an earlier test.

Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Discussion: https://postgr.es/m/CALDaNm1r2MkGu6h8zgU1Kj1sX-FcMQ7wGTeLSnhx-5joiyXEvg@mail.gmail.com
Backpatch-through: 19, where it was introduced

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/5624de9904ca560c0d4473cb9e86108f4b69be38

Modified Files
--------------
src/backend/commands/publicationcmds.c | 73 ++++++++++++++++++----------------
src/test/subscription/t/037_except.pl  | 21 +++++-----
2 files changed, 51 insertions(+), 43 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* pgsql: Validate ALTER PUBLICATION after acquiring the publication lock.
@ 2026-09-11 04:27 Amit Kapila <akapila@postgresql.org>
  0 siblings, 0 replies; 2+ messages in thread

From: Amit Kapila @ 2026-09-11 04:27 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

Validate ALTER PUBLICATION after acquiring the publication lock.

AlterPublicationOptions() can use stale publication state when the
publication is modified concurrently while waiting for the publication
lock. In particular, a concurrent ALTER PUBLICATION ... SET ALL TABLES
can change puballtables, causing the validation to make decisions based
on the old value and leads to assertion failure. Likewise,
CheckAlterPublication() could miss a table added concurrently, letting
SET ALL TABLES EXCEPT (...) leave pg_publication_rel with a mixture of
inclusion and exclusion rows.

Fix by acquiring the lock and re-reading the publication tuple in
AlterPublication() before either path runs, and by calling
CheckAlterPublication() only after that.

Also fix 037_except.pl, which left one computed result untested and
silently reused a subscription created by an earlier test.

Author: Vignesh C <vignesh21@gmail.com>
Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: shveta malik <shveta.malik@gmail.com>
Reviewed-by: Hayato Kuroda <kuroda.hayato@fujitsu.com>
Discussion: https://postgr.es/m/CALDaNm1r2MkGu6h8zgU1Kj1sX-FcMQ7wGTeLSnhx-5joiyXEvg@mail.gmail.com
Backpatch-through: 19, where it was introduced

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/f6b2d6b827a0f1a7485ca43a64b9ddfbebcd2934

Modified Files
--------------
src/backend/commands/publicationcmds.c | 73 ++++++++++++++++++----------------
src/test/subscription/t/037_except.pl  | 21 +++++-----
2 files changed, 51 insertions(+), 43 deletions(-)



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2026-09-11 04:27 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2026-09-11 04:27 pgsql: Validate ALTER PUBLICATION after acquiring the publication lock. Amit Kapila <akapila@postgresql.org>
2026-09-11 04:27 pgsql: Validate ALTER PUBLICATION after acquiring the publication lock. Amit Kapila <akapila@postgresql.org>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox