Re: Review items for EXCEPT TABLE publication
Re: Review items for EXCEPT TABLE publication
От:
Chao Li <li.evan.chao@gmail.com>
Дата:
> On Sep 10, 2026, at 13:39, vignesh C wrote: > > Finding #2: ALTER PUBLICATION validates against pre-lock state > > CheckAlterPublication() validates that pg_publication_rel entries are > either all inclusions or all exclusions. However, this check is > performed before LockDatabaseObject(). A concurrent ALTER PUBLICATION > can therefore add an inclusion while another session is validating and > waiting for the lock. The second command then proceeds without > revalidating after the lock is acquired, leaving the publication with > a mixture of inclusion and exclusion entries. > > Test to reproduce: > -- session 1: -- session 2: > CREATE PUBLICATION p; > BEGIN; > ALTER PUBLICATION p > ADD TABLE t2; > ALTER PUBLICATION p > SET ALL TABLES EXCEPT (TABLE t1); > -- passes CheckAlterPublication() > -- while s1's row is invisible, > -- then blocks on the lock > COMMIT; -- resumes without re-checking > > The fix is to perform CheckAlterPublication() after acquiring the > publication lock, so that validation is performed against the current > publication state. > > > Regards, > Vignesh > v1-0002 looks correct and appears to fix the race described in finding 2. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/