Fix shadow variable warning in subscriptioncmds.c.
authorAmit Kapila <[email protected]>
Wed, 3 Dec 2025 03:31:31 +0000 (03:31 +0000)
committerAmit Kapila <[email protected]>
Wed, 3 Dec 2025 03:31:31 +0000 (03:31 +0000)
Author: Shlok Kyal <[email protected]>
Author: Peter Smith <[email protected]>
Reviewed-by: Chao Li <[email protected]>
Reviewed-by: Vignesh C <[email protected]>
Discussion: https://postgr.es/m/CAHut+PsF8R0Bt4J3c92+T2F0mun0rRfK=-GH+iBv2s-O8ahJJw@mail.gmail.com

src/backend/commands/subscriptioncmds.c

index 24b70234b3559844e13ebede1690a7bce965fab3..8c856af3493bdfc29d14ae2f7c87ca82661c46d8 100644 (file)
@@ -1122,10 +1122,10 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data,
                 * to be at the end because otherwise if there is an error while doing
                 * the database operations we won't be able to rollback dropped slots.
                 */
-               foreach_ptr(SubRemoveRels, rel, sub_remove_rels)
+               foreach_ptr(SubRemoveRels, sub_remove_rel, sub_remove_rels)
                {
-                       if (rel->state != SUBREL_STATE_READY &&
-                               rel->state != SUBREL_STATE_SYNCDONE)
+                       if (sub_remove_rel->state != SUBREL_STATE_READY &&
+                               sub_remove_rel->state != SUBREL_STATE_SYNCDONE)
                        {
                                char            syncslotname[NAMEDATALEN] = {0};
 
@@ -1139,7 +1139,7 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data,
                                 * dropped slots and fail. For these reasons, we allow
                                 * missing_ok = true for the drop.
                                 */
-                               ReplicationSlotNameForTablesync(sub->oid, rel->relid,
+                               ReplicationSlotNameForTablesync(sub->oid, sub_remove_rel->relid,
                                                                                                syncslotname, sizeof(syncslotname));
                                ReplicationSlotDropAtPubNode(wrconn, syncslotname, true);
                        }