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 1vIlY2-00DVuA-0n for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 10:24:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vIlXz-005I5X-23 for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Nov 2025 10:24:23 +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 1vIlXz-005I5F-10 for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 10:24:23 +0000 Received: from mail-oi1-x22e.google.com ([2607:f8b0:4864:20::22e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vIlXw-0078nJ-1y for pgsql-hackers@lists.postgresql.org; Tue, 11 Nov 2025 10:24:22 +0000 Received: by mail-oi1-x22e.google.com with SMTP id 5614622812f47-44fa4808c15so578745b6e.3 for ; Tue, 11 Nov 2025 02:24:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1762856658; x=1763461458; 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=dSu4dn+at+kgJoteG4RDfrrS3OHqm3Z1epoe2GMBads=; b=I9TQB07h4oAAvh5AkVmR68bAlCkB585lCvuw+7zFsSU2AuPGgHp5I8JlENVRCpHcPZ ro28/VOHWLLS/3D3YUFxY42uS1/I1QOiK00c2xTjjkwlNmq/WRq2tgZmRQkROuhot776 vtR2JA9WZOiAel/jqoEN+z5o/UIo+k3+JqYp8u45zdKxv8j/JWM1abf/BFzH9dVuxTDL Dfy+CHq4NbnKfNNlvFfvNW3Yvd7OoS3w5OhAxuKxWrgVAUYdWNCmFSo1X/Bj/obEQsF1 wxsbZuAhLEIjB5dN3lirGTf0okpWwdnO+Q9jPpx92f1q7VGQzaYSTuw5qe/CBapsyjDr bmgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1762856658; x=1763461458; 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=dSu4dn+at+kgJoteG4RDfrrS3OHqm3Z1epoe2GMBads=; b=AUAH8WDK78mUDCgumoF5lMiVzfzIf2bdM5OeJLpfrastL7s+XyWF8fHqd/SSNfIQHn tQQhskQnrizvFlsgk1UumKhz1jmyHsFCW1VkHnBtbtqlb/B/QfSDbe7tWLlKJma6Gqnq pz1OpN1cMS49djdsGLHVE2mQPSoOXE61R81irLRgGPpj9xjsvOSZsdhcuhWZQegkvvRH H+z5QKwieo6+aogUveBY1deYB+dUvNOaxBv9BjCMtli2ZVLgZbqDd9OfQ0OrRci0/dSl FfZt7ayeB7Ie07P/guWZNi9ozmWCt6KX4cS1O0spsev6FDrdbpd96HHojLGlwXdqnUym PSCw== X-Forwarded-Encrypted: i=1; AJvYcCXm2hHT06Vx7cXcuIcUxWbVqKJcXhdDWp4wQSL9t7DgLidJYUKQrD6XmbAReLg5LHOCNI2NemJn0uk8Znq2@lists.postgresql.org X-Gm-Message-State: AOJu0YybthoR48POq1364iRG+QruZ3/39tOBFSmdYnV+r3TC3mQNLbTX y6iXUSqhj7oLawdBH7vi/8FGfu9TAscf1AuJ+tvdvfKESd9KIpTn62MXZagqyqOTv6gBi9fnWId w1wbB23w4sriJwaUwPnlgHuVpjRAnurY= X-Gm-Gg: ASbGncuaSp4Y7uIZXcJkRy5KAJBScHWOzCqgmALtiu8HuhBhuZV68fEEh/e35uvve+N 0jDooGXcyKFkztepLWLn3T0fUSa70ZRu7KT23Vf28vFNG4YuLd0oTWjMD63MsR62fK+uwwd8sBh 4swdZ5DzpBFZ3KmJrgvFo79uZCHMwPHCiiNr4SLBKj23v5IHn2btN663keBG75qbnWzxbjX+zt2 YZQoqnzC7Br3G6w9ksFmviLHkzXYQNFFI3BH3V+qCZLQ0Rn92V2l8bYkEKIPbo= X-Google-Smtp-Source: AGHT+IEStv5TumARhEt4bvBwfZ883FiI6ApGPlvKYIz3yyNJXXZeRCNxo9BDkEWG6VAcogAVmV8GtfaSKsN/XK8Pc2g= X-Received: by 2002:a05:6808:6c96:b0:450:4782:2b0e with SMTP id 5614622812f47-450478230ddmr3849195b6e.15.1762856658043; Tue, 11 Nov 2025 02:24:18 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Shlok Kyal Date: Tue, 11 Nov 2025 15:54:06 +0530 X-Gm-Features: AWmQ_bm7_NGcjE-eP8IeMZwlAGQ1yS6yHLnnu3G9hncsO7L424QN-xruSX6Nn8c 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 Fri, 24 Oct 2025 at 06:41, Peter Smith wrote: > > Hi Vignesh, > > I had a look at patch v24-0001. > > FYI -- a rebase is needed > > [postgres@CentOS7-x64 oss_postgres_misc]$ git apply > ../patches_misc/v24-0001-Add-RESET-clause-to-Alter-Publication-which-will.patch > error: patch failed: doc/src/sgml/ref/alter_publication.sgml:69 > error: doc/src/sgml/ref/alter_publication.sgml: patch does not apply > > Here are some other review comments: > > ====== > > 1. > There seems to be some basic omission of the ALTER PUBLICATION in that > it does not support "ALL TABLES" as a publication_object. > > Therefore, if you have: > CREATE PUBLICATION mypub FOR ALL TABLES; > > and then you do: > ALTER PUBLICATION mypub RESET; > > There seems to be no way to restore mpub to be an ALL TABLES publication again! > > ~~~ > > I think if you are going to implement a RESET, then you also need a > way to get back to what you had before you did the reset. So you'll > also need to implement the ALTER PUBLICATION mypub SET ALL TABLES; > > IMO, supporting "SET ALL TABLES" should be your new 0001 patch > because AFAIK, this situation already exists if the user had created > an "empty" publication: > CREATE PUBLICATION myemptypub; > With current patches we can add ALL TABLES to a publication using "ADD ALL TABLES" I think once the ADD ALL TABLES patch is committed, we can add SET ALL TABLES. > ====== > doc/src/sgml/ref/alter_publication.sgml > > 2. > Probably need to mention ALL SEQUENCES now too? > > ====== > src/backend/commands/publicationcmds.c > > 3. > +/* CREATE PUBLICATION default values for flags and publication parameters */ > +#define PUB_DEFAULT_ACTION_INSERT true > +#define PUB_DEFAULT_ACTION_UPDATE true > +#define PUB_DEFAULT_ACTION_DELETE true > +#define PUB_DEFAULT_ACTION_TRUNCATE true > +#define PUB_DEFAULT_VIA_ROOT false > +#define PUB_DEFAULT_ALL_TABLES false > +#define PUB_DEFAULT_GENCOLS PUBLISH_GENCOLS_NONE > + > > Is it better to put all these in the catalog/pg_publication.h where > the catalog was defined? > > ~~~ > > AlterPublicationReset: > > 4. > + /* Set ALL TABLES flag to false */ > + if (pubform->puballtables) > + { > + values[Anum_pg_publication_puballtables - 1] = > BoolGetDatum(PUB_DEFAULT_ALL_TABLES); > + replaces[Anum_pg_publication_puballtables - 1] = true; > + CacheInvalidateRelcacheAll(); > + } > > Why not just do this anyway without the condition? > > ====== > src/backend/parser/gram.y > > 6. > It would be nicer if all these grammar productions were coded in the > same order as the comment above them. > > ====== > src/include/nodes/parsenodes.h > > 7. > AP_AddObjects, /* add objects to publication */ > AP_DropObjects, /* remove objects from publication */ > AP_SetObjects, /* set list of objects */ > + AP_ResetPublication, /* reset the publication */ > } AlterPublicationAction; > > It is already called "AlterPublicationAction", so maybe the enum value > only needs to be AP_Reset instead of AP_ResetPublication. > > > ====== > src/test/regress/expected/publication.out > > 8. > Expected output all needs rebasing now that there is a new "All > sequences" column. > > ====== > src/test/regress/sql/publication.sql > > 9. > +ALTER PUBLICATION testpub_reset ADD TABLE pub_sch1.tbl1; > + > +-- Verify that associated tables are removed from the publication after RESET > +\dRp+ testpub_reset > +ALTER PUBLICATION testpub_reset RESET; > +\dRp+ testpub_reset > + > > I felt the ADD TABLE should be after the comment. > > And ditto for all the other test cases -- should be that same pattern too. > > # comment about test > ALTER .. do something > \dRp+ pub > ALTER .. RESET > \dRp+ pub > > ~~~ > > 10. > +-- Verify that associated schemas are reomved from the publication after RESET > > typo: /reomved/removed/ > > ~~~ > > 11. > +-- Verify that only superuser can reset a publication > +ALTER PUBLICATION testpub_reset OWNER TO regress_publication_user2; > +SET ROLE regress_publication_user2; > +ALTER PUBLICATION testpub_reset RESET; -- fail - must be superuser > +SET ROLE regress_publication_user; > + > > Perhaps this should be the first test? > > ====== I have 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