File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 33
33
#include "utils/lsyscache.h"
34
34
35
35
36
+ /* Borrowed from joinpath.c */
37
+ #define PATH_PARAM_BY_REL (path , rel ) \
38
+ ((path)->param_info && bms_overlap(PATH_REQ_OUTER(path), (rel)->relids))
39
+
40
+
36
41
set_join_pathlist_hook_type set_join_pathlist_next = NULL ;
37
42
set_rel_pathlist_hook_type set_rel_pathlist_hook_next = NULL ;
38
43
planner_hook_type planner_hook_next = NULL ;
@@ -130,7 +135,11 @@ pathman_join_pathlist_hook(PlannerInfo *root,
130
135
/* Select cheapest path for outerrel */
131
136
outer = outerrel -> cheapest_total_path ;
132
137
133
- /* Wrap outer path with Unique if needed */
138
+ /* We cannot use an outer path that is parameterized by the inner rel */
139
+ if (PATH_PARAM_BY_REL (outer , innerrel ))
140
+ continue ;
141
+
142
+ /* Wrap 'outer' in unique path if needed */
134
143
if (saved_jointype == JOIN_UNIQUE_OUTER )
135
144
{
136
145
outer = (Path * ) create_unique_path (root , outerrel ,
You can’t perform that action at this time.
0 commit comments