-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathkeep_path_PG17-main.patch
More file actions
101 lines (92 loc) · 2.74 KB
/
Copy pathkeep_path_PG17-main.patch
File metadata and controls
101 lines (92 loc) · 2.74 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
diff --git a/src/backend/optimizer/util/pathnode.c b/src/backend/optimizer/util/pathnode.c
index c42742d..6f12c9d 100644
--- a/src/backend/optimizer/util/pathnode.c
+++ b/src/backend/optimizer/util/pathnode.c
@@ -577,26 +577,9 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
}
}
- /*
- * Remove current element from pathlist if dominated by new.
- */
- if (remove_old)
- {
- parent_rel->pathlist = foreach_delete_current(parent_rel->pathlist,
- p1);
-
- /*
- * Delete the data pointed-to by the deleted cell, if possible
- */
- if (!IsA(old_path, IndexPath))
- pfree(old_path);
- }
- else
- {
- /* new belongs after this old path if it has cost >= old's */
- if (new_path->total_cost >= old_path->total_cost)
- insert_at = foreach_current_index(p1) + 1;
- }
+ /* Get location for new path if it has cost >= old */
+ if (new_path->total_cost >= old_path->total_cost)
+ insert_at = foreach_current_index(p1) + 1;
/*
* If we found an old path that dominates new_path, we can quit
@@ -607,18 +590,8 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
break;
}
- if (accept_new)
- {
- /* Accept the new path: insert it at proper place in pathlist */
- parent_rel->pathlist =
- list_insert_nth(parent_rel->pathlist, insert_at, new_path);
- }
- else
- {
- /* Reject and recycle the new path */
- if (!IsA(new_path, IndexPath))
- pfree(new_path);
- }
+ /* Always accept the new path */
+ parent_rel->pathlist = list_insert_nth(parent_rel->pathlist, insert_at, new_path);
}
/*
@@ -813,21 +786,9 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path)
}
}
- /*
- * Remove current element from partial_pathlist if dominated by new.
- */
- if (remove_old)
- {
- parent_rel->partial_pathlist =
- foreach_delete_current(parent_rel->partial_pathlist, p1);
- pfree(old_path);
- }
- else
- {
- /* new belongs after this old path if it has cost >= old's */
- if (new_path->total_cost >= old_path->total_cost)
- insert_at = foreach_current_index(p1) + 1;
- }
+ /* Get location for new path if it has cost >= old */
+ if (new_path->total_cost >= old_path->total_cost)
+ insert_at = foreach_current_index(p1) + 1;
/*
* If we found an old path that dominates new_path, we can quit
@@ -838,17 +799,8 @@ add_partial_path(RelOptInfo *parent_rel, Path *new_path)
break;
}
- if (accept_new)
- {
- /* Accept the new path: insert it at proper place */
- parent_rel->partial_pathlist =
- list_insert_nth(parent_rel->partial_pathlist, insert_at, new_path);
- }
- else
- {
- /* Reject and recycle the new path */
- pfree(new_path);
- }
+ /* Always accept the new path */
+ parent_rel->partial_pathlist = list_insert_nth(parent_rel->partial_pathlist, insert_at, new_path);
}
/*