Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIlYN-00DWBo-1C for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 10:24:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIlYL-005K4m-0F for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 10:24:45 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vIlYK-005K4b-2Q for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 10:24:44 +0000 Received: from mail-oi1-x233.google.com ([2607:f8b0:4864:20::233]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIlYI-0078oH-1K for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 10:24:44 +0000 Received: by mail-oi1-x233.google.com with SMTP id 5614622812f47-4505b05e7b5so358681b6e.2 for ; Tue, 11 Nov 2025 02:24:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762856681; x=1763461481; darn=lists.postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=UF7jW8mLqlGXx213TuqiTMcwocwSDPC00tzllOriyvA=; b=OUqG3GdL0qRryKB30S/HIGWKoPN3BRpJwxC9KmHDPlJBE20xkTh/cv9Q75VHbI/q79 zx2eS1XjhRfzNLuGkhrao5rxjEWrJ+o6lYSt9jB3bLsPngtRZYe8hX6IIDnYc2rKm5fD 0Gj+N/70AY5opffZqDf/jss51MJcdy//0YgSyRYmYzWJ81pWoTBC5EeUOhhHYIWQjkeO RLUTSfc83ROHm24AGWJD7fNiCd7ep3j2mJS23xNaiENj9vOPX2hFlRDLtq8wkUxPxpeG bjk4HuszcLSLsxE59B4/vfRTO1l45zj+00SSB5yNn1odbHqwLEuAeXP0NamPq7shu64C te7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762856681; x=1763461481; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=UF7jW8mLqlGXx213TuqiTMcwocwSDPC00tzllOriyvA=; b=kPIGV56ic0MwzQ/LBCVyWFMKRAecb10pOaC2LbDT1agHah3g1HU3O+rF2jy11vZIsy 1tpWwsBTVIbvAAWQmqpp2OO8giwVbqNvGZB9vDgduN7KPY0Cmsg4n7HueSeLPnoweHFa h3RaY16EIAl6TP/6E36uGU2XsxdoFtp8FsQ+Z/bwvqBVJVg9w1c8oTMaEwiYxC+FaxuW P1cQLdLSGpr/vQ555qhLqTZYYK5cWOmFZdQ/i+3L8SUlWcL/KIteAEHgW5vQGKCdQqLl Jztbb010vPeSAKVIge9TOw7VDD+LcqJlplju8k+B/cFBwtVYXZx/C2Z8QqG+EKl2RlYu HKwQ== X-Forwarded-Encrypted: i=1; AJvYcCUdnY2nTRqbJsBupxcsVVsG2CjIaUu572pDHEpngjWrfV7R0Uu7pg2aaGEddxPzW9bb0LJ2LLqfVArzsqyJ@lists.postgresql.org X-Gm-Message-State: AOJu0Yw0f1y5aFvOdWbZIrmcwDuKPDpUGEout1B+/s7GwtceR273v1Nf fbCltAAlmdSHE8RJTGUxE9wtOsEZOOjNetDuiX+vbIb/rBIWrbE92n9OHu8GUdwyIunBGrZFZJv POXvYk6OEuYSuE2z28sCYVHNSb6QyyQc= X-Gm-Gg: ASbGncsSoHCkdtkrZYyV8jNlYZ1ZlEJ8s2CntDYaUbfuP0W6pFjsIsFXj3jvdn/U/2y cfsBaGMWHA5zR7hGaL8uRhEPVfDCwpnXOo29A1P9eCZruotvzqJ73pgGQqPykaA9jv6NIDvwwCu WvIWzOAawxEXSOihQvZiYJp6nJw3vzrcRV4xeZu8jL6yT/EvY1I1D3d17TmC6zv2JG37gmgzgwG Ve1Ayowzo+tVSO2LTRqtSbBoFhhfzKtroUoQTm5LpOF6l+LuD7b1ZjsMMo9Q5/MyjdUDPtK2xCG 0ybLkVS8 X-Google-Smtp-Source: AGHT+IH0YkUJJKH4wxxwUPwKAcJ/sNLepgfSlCR0Tt/EvYHd+YqT80XeKNCuA1bUGR48ERhEzmtXTEAcCRMSV/HKjJM= X-Received: by 2002:a05:6808:1894:b0:44d:af21:bf34 with SMTP id 5614622812f47-4502a19b6bdmr5259537b6e.2.1762856680677; Tue, 11 Nov 2025 02:24:40 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Shlok Kyal Date: Tue, 11 Nov 2025 15:54:29 +0530 X-Gm-Features: AWmQ_bkCmrOWr1O0o9pA-F-aaiy7Gf3oUiUrQGhBAyi2M0Hi6hAQkPfh2ewBcIE Message-ID: Subject: Re: Skipping schema changes in publication To: Peter Smith Cc: vignesh C , Amit Kapila , "Zhijie Hou (Fujitsu)" , YeXiu <1518981153@qq.com>, Ian Lawrence Barwick , Bharath Rupireddy , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 30 Oct 2025 at 11:34, Peter Smith wrote: > > Hi Vignesh > > Here are some review comments for the patch v24-0002. > > These comments are just for the SGML docs. The patch needs a rebase so > I was unable to review the code. > > ====== > Commit message > > 1. > A new column "prexcept" is added to table "pg_publication_rel", to maintain > the relations that the user wants to exclude from the publications. > > ~ > > /to maintain/to flag/ > > ====== > doc/src/sgml/logical-replication.sgml > > 2. > > - To add tables to a publication, the user must have ownership rights on the > - table. To add all tables in schema to a publication, the user must be a > - superuser. To create a publication that publishes all tables or > all tables in > - schema automatically, the user must be a superuser. > + To create a publication using FOR ALL TABLES or FOR ALL TABLES IN SCHEMA, > + the user must be a superuser. To add ALL TABLES or ALL TABLES IN SCHEMA to a > + publication, the user must be a superuser. To add tables to a publication, > + the user must have ownership rights on the table. > > > Those "FOR ALL TABLES" etc are missing SGML markup. > > ====== > doc/src/sgml/ref/alter_publication.sgml > > 3. > +ALTER PUBLICATION name > ADD ALL TABLES [ EXCEPT [ TABLE ] class="parameter">exception_object [, ... ] ] > > and > > + > +where class="parameter">exception_object is: > + > + [ ONLY ] table_name [ * ] > + > > It is not clear from the syntax which of these is possible. > > ... ADD ALL TABLES EXCEPT TABLE t1,t2,t3 > ... ADD ALL TABLES EXCEPT TABLE t1, TABLE t2, TABLES t3 > > IMO it is best put the "[TABLE]" within the exception_object: > [ TABLE ] [ ONLY ] table_name [ * ] > > Then both are possible, which is consistent with how "FOR TABLE" syntax works. > > Furthermore, you might want later to say EXCLUDE SEQUENCE, so doing it > this way makes that possible. > Recently a commit was pushed which allowed use of ALL SEQUENCES syntax. Due to it, I have updated the syntax to CREATE PUBLICATION ... ALL TABLES EXCEPT TABLE(t1, t2, t3); For ALTER PUBLICATION to have a similar syntax. I have updated it to have syntax like: ALTER PUBLICATION ... ADD ALL TABLES EXCEPT TABLE(t1, t2, t3); I think in the future we can extend the syntax for sequences like: ALL SEQUENCES EXCEPT(s1, s2, s3). See [1] for more info. > ~~~ > > 4. > - Adding a table to a publication additionally requires owning that table. > - The ADD TABLES IN SCHEMA, > + Adding a table to or excluding a table from a publication additionally > + requires owning that table. The ADD ALL TABLES, > > This wording seems a bit awkward. How are re-phrasing like: > > SUGGESTION > Adding or excluding a table from a publication requires ownership of that table. > > ~~~ > > 5. > - name to explicitly indicate that descendant tables are included. > + name to explicitly indicate that descendant tables are affected. For > + partitioned tables, ONLY donot have any effect. > > typo: /donot/does not/ > > ====== > doc/src/sgml/ref/create_publication.sgml > > 6. > - [ FOR ALL TABLES > + [ FOR ALL TABLES [ EXCEPT [ TABLE ] class="parameter">exception_object [, ... ] ] > | FOR class="parameter">publication_object [, ... ] ] > [ WITH ( class="parameter">publication_parameter [= class="parameter">value] [, ... ] ) ] > > @@ -30,6 +30,10 @@ CREATE PUBLICATION class="parameter">name > > TABLE [ ONLY ] class="parameter">table_name [ * ] [ ( class="parameter">column_name [, ... ] ) ] [ WHERE ( > expression ) ] [, ... ] > TABLES IN SCHEMA { class="parameter">schema_name | CURRENT_SCHEMA } [, ... > ] > + > +where class="parameter">exception_object is: > + > + [ ONLY ] table_name [ * ] > > Same review comment as #3 before. > > I think it is clearer (and more flexible) to change the > exception_object to include [TABLE]. > [ TABLE ] [ ONLY ] table_name [ * ] > > It also helps pave the way for any future EXCLUDE SEQUENCE feature. > See #3 before . > ~~~ > > 7. > + > + This clause specifies a list of tables to be excluded from the > + publication. It can only be used with FOR ALL TABLES. > + If ONLY is specified before the table name, only > + that table is excluded from the publication. If > ONLY is > + not specified, the table and all its descendant tables (if any) are > + excluded. Optionally, * can be specified after the > + table name to explicitly indicate that descendant tables are excluded. > + This does not apply to a partitioned table, however. The partitioned > + table or its partitions are excluded from the publication based on the > + parameter publish_via_partition_root. > + > + > + When publish_via_partition_root is set to > + true, specifying a root partitioned table in > + EXCEPT TABLE excludes it and all its partitions from > + replication. Specifying a leaf partition has no effect, as its > changes are > + still replicated via the root partitioned table. When > + publish_via_partition_root is set to > + false, specifying a partitioned table or non-leaf > + partition has no effect, as changes are replicated via the leaf > + partitions. Specifying a leaf partition excludes only that partition from > + replication. > + > > I felt that the second paragraph should be started with the sentence > "The partitioned table or its partitions are excluded...", so then > everything related to "publish_via_partition_root" is kept together. > > ~~~ > > 8. > + > + Create a publication that publishes all changes in all the tables except for > + the changes of users and > + departments: > + > +CREATE PUBLICATION mypublication FOR ALL TABLES EXCEPT users, departments; > + > + > > The words "the changes of" are not needed, and you did not use that > wording in the ALTER PUBLICATION example. > > ====== > doc/src/sgml/ref/psql-ref.sgml > > 9. > If x is appended to the command name, the results > are displayed in expanded mode. > - If + is appended to the command name, the tables and > - schemas associated with each publication are shown as well. > + If + is appended to the command name, the tables, > + excluded tables and schemas associated with each publication > are shown as > + well. > > > /excluded tables and schemas/excluded tables, and schemas/ > I addressed the remaining comments in the latest v26 patch [1]. [1]:https://www.postgresql.org/message-id/CANhcyEWGiWwGt1-v6d9bCAae9Np7cNPt%2BiRV9PXBZ0z%3D75XEVw%40mail.gmail.com Thanks, Shlok Kyal