v1-0002-Remove-glob-subplanNames.patch
application/octet-stream
Filename: v1-0002-Remove-glob-subplanNames.patch
Type: application/octet-stream
Part: 0
Message:
Re: plan shape work
From e72960487aa269f3d400a7b6149eb22c08a2ebef Mon Sep 17 00:00:00 2001
From: Robert Haas <rhaas@postgresql.org>
Date: Mon, 8 Dec 2025 13:55:55 -0500
Subject: [PATCH v1 2/2] Remove glob->subplanNames.
glob->allroots is sufficient; we don't need both.
---
src/backend/optimizer/plan/planner.c | 18 ------------------
src/include/nodes/pathnodes.h | 3 ---
2 files changed, 21 deletions(-)
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 47b32b20e1a..ccf1aad98c0 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -8963,26 +8963,12 @@ create_partial_unique_paths(PlannerInfo *root, RelOptInfo *input_rel,
/*
* Choose a unique name for some subroot.
- *
- * Modifies glob->subplanNames to track names already used.
*/
char *
choose_plan_name(PlannerGlobal *glob, const char *name, bool always_number)
{
unsigned n;
-#ifdef USE_ASSERT_CHECKING
- Assert(list_length(glob->allroots) == list_length(glob->subplanNames) + 1);
- foreach_ptr(char, subplan_name, glob->subplanNames)
- {
- PlannerInfo *subroot;
-
- subroot = list_nth(glob->allroots,
- foreach_current_index(subplan_name) + 1);
- Assert(strcmp(subroot->plan_name, subplan_name) == 0);
- }
-#endif
-
/*
* If a numeric suffix is not required, then search the list of
* previously-assigned names for a match. If none is found, then we can
@@ -9007,7 +8993,6 @@ choose_plan_name(PlannerGlobal *glob, const char *name, bool always_number)
/* pstrdup here is just to avoid cast-away-const */
char *chosen_name = pstrdup(name);
- glob->subplanNames = lappend(glob->subplanNames, chosen_name);
return chosen_name;
}
}
@@ -9033,10 +9018,7 @@ choose_plan_name(PlannerGlobal *glob, const char *name, bool always_number)
}
if (!found)
- {
- glob->subplanNames = lappend(glob->subplanNames, proposed_name);
return proposed_name;
- }
pfree(proposed_name);
}
diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h
index 2707ca50019..103186a2f97 100644
--- a/src/include/nodes/pathnodes.h
+++ b/src/include/nodes/pathnodes.h
@@ -113,9 +113,6 @@ typedef struct PlannerGlobal
/* every non-transient PlannerInfo (superset of subroots) */
List *allroots pg_node_attr(read_write_ignore);
- /* names already used for subplans (list of C strings) */
- List *subplanNames pg_node_attr(read_write_ignore);
-
/* indices of subplans that require REWIND */
Bitmapset *rewindPlanIDs;
--
2.51.0