Re: Skipping schema changes in publication
vignesh C <vignesh21@gmail.com>
From: vignesh C <vignesh21@gmail.com>
To: Peter Smith <smithpb2250@gmail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>, Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-05-10T03:38:48Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix miscellaneous issues in EXCEPT publication clause.
- 6b0550c45d13 19 (unreleased) landed
-
Change syntax of EXCEPT TABLE clause in publication commands.
- 5984ea868eee 19 (unreleased) landed
-
Add support for EXCEPT TABLE in ALTER PUBLICATION.
- 493f8c6439cf 19 (unreleased) landed
-
Allow table exclusions in publications via EXCEPT TABLE.
- fd366065e06a 19 (unreleased) landed
-
Add wait_for_subscription_sync for TAP tests.
- 0c20dd33db16 16.0 cited
On Fri, May 6, 2022 at 8:05 AM Peter Smith <smithpb2250@gmail.com> wrote: > > On Thu, Apr 28, 2022 at 9:32 PM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > ... > > > > Another idea that occurred to me today for tables this is as follows: > > 1. Allow to mention except during create publication ... For All Tables. > > CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT TABLE t1,t2; > > 2. Allow to Reset it. This new syntax will reset all objects in the > > publications. > > Alter Publication ... RESET; > > 3. Allow to add it to an existing publication > > Alter Publication ... Add ALL TABLES [EXCEPT TABLE t1,t2]; > > > > I think it can be extended in a similar way for schema syntax as well. > > > > If the proposed syntax ALTER PUBLICATION ... RESET will reset all the > objects in the publication then there still seems simple way to remove > only the EXCEPT list but leave everything else intact. IIUC to clear > just the EXCEPT list would require a 2 step process - 1) ALTER ... > RESET then 2) ALTER ... ADD ALL TABLES again. > > I was wondering if it might be useful to have a variation that *only* > resets the EXCEPT list, but still leaves everything else as-is? > > So, instead of: > ALTER PUBLICATION pubname RESET +1 for this syntax as this syntax can be extendable to include options like (except/all/etc) later. Currently we can support this syntax and can be extended later based on the requirements. The new feature will handle the various use cases based on the behavior given below: -- CREATE Publication with EXCEPT TABLE syntax CREATE PUBLICATION pub1 FOR ALL TABLES EXCEPT TABLE t1,t2; -- ok Alter Publication pub1 RESET; -- All Tables and options are reset similar to creating publication without any publication object and publication option (create publication pub1) \dRp+ pub1 Publication pub2 Owner | All tables | Inserts | Updates | Deletes | Truncates | Via root ---------+------------+---------+---------+---------+-----------+---------- vignesh | f | t | t | t | t | f (1 row) -- Can add except table after reset of publication ALTER PUBLICATION pub1 Add ALL TABLES EXCEPT TABLE t1,t2; -- ok -- Cannot add except table without reset of publication ALTER PUBLICATION pub1 Add EXCEPT TABLE t3,t4; -- not ok, need to be reset Alter Publication pub1 RESET; -- Cannot add table to ALL TABLES Publication ALTER PUBLICATION pub1 Add ALL TABLES EXCEPT TABLE t1,t2, t3, t4, TABLE t5; -- not ok, ALL TABLES Publications does not support including of TABLES Alter Publication pub1 RESET; -- Cannot add table to ALL TABLES Publication ALTER PUBLICATION pub1 Add ALL TABLES TABLE t1,t2; -- not ok, ALL TABLES Publications does not support including of TABLES -- Cannot add ALL TABLES IN SCHEMA to ALL TABLES Publication ALTER PUBLICATION pub1 Add ALL TABLES ALL TABLES IN SCHEMA sch1, sch2; -- not ok, ALL TABLES Publications does not support including of ALL TABLES IN SCHEMA -- Existing syntax should work as it is CREATE PUBLICATION pub1 FOR TABLE t1; ALTER PUBLICATION pub1 ADD TABLE t1; -- ok, existing ALTER should work as it is (ok without reset) ALTER PUBLICATION pub1 ADD ALL TABLES IN SCHEMA sch1; -- ok, existing ALTER should work as it is (ok without reset) ALTER PUBLICATION pub1 DROP TABLE t1; -- ok, existing ALTER should work as it is (ok without reset) ALTER PUBLICATION pub1 DROP ALL TABLES IN SCHEMA sch1; -- ok, existing ALTER should work as it is (ok without reset) ALTER PUBLICATION pub1 SET TABLE t1; -- ok, existing ALTER should work as it is (ok without reset) ALTER PUBLICATION pub1 SET ALL TABLES IN SCHEMA sch1; -- ok, existing ALTER should work as it is (ok without reset) I will modify the patch to handle this. Regards, Vignesh