Update comments for AlterSubscription.
authorAmit Kapila <[email protected]>
Mon, 19 Jul 2021 03:02:37 +0000 (08:32 +0530)
committerAmit Kapila <[email protected]>
Mon, 19 Jul 2021 03:02:37 +0000 (08:32 +0530)
Add explanation as to why the subscription needs to be disabled to allow
slot_name as none.

Author: Japin Li and Amit Kapila
Discussion: https://postgr.es/m/MEYP282MB1669CBD98E721C77CA696499B61A9@MEYP282MB1669.AUSP282.PROD.OUTLOOK.COM

src/backend/commands/subscriptioncmds.c

index 239d263f835e7c24a8fbbb0a322b1aa86298a0a0..cc4c1b47e4ee05d5903d63a4fc4148787bb2e74d 100644 (file)
@@ -894,6 +894,13 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
 
                if (IsSet(opts.specified_opts, SUBOPT_SLOT_NAME))
                {
+                   /*
+                    * The subscription must be disabled to allow slot_name as
+                    * 'none', otherwise, the apply worker will repeatedly try
+                    * to stream the data using that slot_name which neither
+                    * exists on the publisher nor the user will be allowed to
+                    * create it.
+                    */
                    if (sub->enabled && !opts.slot_name)
                        ereport(ERROR,
                                (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),