On Thu, 26 Nov 2026 at 15:25, shveta malik <[email protected]> wrote: > > On Thu, Nov 26, 2026 at 2:27 PM Hayato Kuroda (Fujitsu) > <[email protected]> wrote: > > > > Hi, > > > > Here is a comment for v97-0002. > > > > I found that conflict log table could be dumped with pg_dump > > --binary-upgrade --no-subscription, > > nevertheless the subscription cannot be dumped with them. This is because > > getSubscriptions() > > can be skipped by dopt->no_subscriptions but selectDumpableTable() does not. > > Maybe we should also check the setting here? > > +1. > I see a similar problem with the '--binary-upgrade -n public' option too: > > --The subscription is skipped, because it isn't in schema public. > --The CLT is still dumped, because the patch's CLT branch says to dump > it in binary-upgrade mode > > The same problem exists with '-t .. --binary-upgrade'. I think there > could be more such combinations too. > > I think this check in selectDumpableTable is not enough, it needs more > checks like: !dopt->no_subscriptions && dopt->include_everything > > + if (dopt->binary_upgrade) > + tbinfo->dobj.dump = DUMP_COMPONENT_DEFINITION | DUMP_COMPONENT_ACL | > +
The CLT is no longer selected independently in selectDumpableTable(). Instead, CLT tables are selected in selectDumpableNamespace(), in the branch handling the pg_conflict schema, just like tables in other schemas. In binary-upgrade mode, the contents of this schema are dumped only if a new helper, subscriptions_are_dumped(), returns true. This helper follows the same conditions used to select and dump subscriptions: a) include_everything is true where the subscription is left out. b) --no-subscriptions is not specified. c) The user is a superuser, since getSubscriptions() only issues a warning and returns for non-superusers. d) The post-data section is included (--section), since subscriptions are dumped in the post-data section, whereas CLTs are in the pre-data section. With these checks, --binary-upgrade combined with --no-subscriptions, -n public, -t ..., or --section=pre-data excludes the CLT along with its subscription. In normal mode, nothing related to a CLT is dumped, including its ACL, because the table is recreated under a new name when the subscription is restored. There is one intentional exception: if a CLT is explicitly selected using -t <clt> or -n pg_conflict, it is dumped like any other table, even if its subscription is not selected. This behavior is documented in the code comment and pg_dump.sgml. The attached v98 version patch has the changes for the same. This patch also fixes Hou san's comments from [1], Kuroda san's comments from [2], Shveta's comments from [3]. [1] - https://www.postgresql.org/message-id/2753b65e-9de8-4306-9f96-fc7e8d4c2ef5%40gmail.com [2] - https://www.postgresql.org/message-id/OS7PR01MB18317716A6C22632EAFC522F7F5422%40OS7PR01MB18317.jpnprd01.prod.outlook.com [3] - https://www.postgresql.org/message-id/CAJpy0uCoDqf8Tu6OO3LqfYqYjDU4XeApUTsdU%2Bti3CHV00QciQ%40mail.gmail.com Regards, Vignesh
v98-0001-Preserve-conflict-log-destination-and-subscripti.patch
Description: Binary data
