1010#include "postgres.h"
1111#include "optimizer/cost.h"
1212#include "optimizer/restrictinfo.h"
13+ #include "utils/guc.h"
1314#include "hooks.h"
1415#include "utils.h"
1516#include "pathman.h"
@@ -106,7 +107,7 @@ pathman_join_pathlist_hook(PlannerInfo *root,
106107inner = create_runtimeappend_path (root ,cur_inner_path ,
107108get_appendrel_parampathinfo (innerrel ,
108109inner_required ),
109- joinclauses , paramsel );
110+ paramsel );
110111
111112initial_cost_nestloop (root ,& workspace ,jointype ,
112113outer ,inner ,
@@ -262,7 +263,6 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
262263
263264for (i = irange_lower (irange );i <=irange_upper (irange );i ++ )
264265append_child_relation (root ,rel ,rti ,rte ,i ,dsm_arr [i ],wrappers );
265-
266266}
267267
268268/* Clear old path list */
@@ -282,8 +282,6 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
282282Relids inner_required = PATH_REQ_OUTER ((Path * )cur_path );
283283ParamPathInfo * ppi = get_appendrel_parampathinfo (rel ,inner_required );
284284Path * inner_path = NULL ;
285- ListCell * subpath_cell ;
286- List * runtime_quals = NIL ;
287285
288286if (!(IsA (cur_path ,AppendPath )|| IsA (cur_path ,MergeAppendPath ))||
289287rel -> has_eclass_joins ||
@@ -292,56 +290,29 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
292290continue ;
293291}
294292
295- foreach (subpath_cell ,cur_path -> subpaths )
296- {
297- Path * subpath = (Path * )lfirst (subpath_cell );
298- RelOptInfo * child_rel = subpath -> parent ;
299- List * quals ;
300- ListCell * qual_cell ;
301- ReplaceVarsContext repl_var_cxt ;
302-
303- repl_var_cxt .child = subpath -> parent ;
304- repl_var_cxt .parent = rel ;
305- repl_var_cxt .sublevels_up = 0 ;
306-
307- quals = extract_actual_clauses (child_rel -> baserestrictinfo , false);
308-
309- /* Do not proceed if there's a rel containing quals without params */
310- if (!clause_contains_params ((Node * )quals ))
311- {
312- runtime_quals = NIL ;/* skip this path */
313- break ;
314- }
315-
316- /* Replace child Vars with a parent rel's Var */
317- quals = (List * )replace_child_vars_with_parent_var ((Node * )quals ,
318- & repl_var_cxt );
319-
320- /* Combine unique quals for RuntimeAppend */
321- foreach (qual_cell ,quals )
322- runtime_quals = list_append_unique (runtime_quals ,
323- (Node * )lfirst (qual_cell ));
324- }
325-
326- /*
327- * Dismiss RuntimeAppend if there
328- * are no parameterized quals
329- */
330- if (runtime_quals == NIL )
331- continue ;
332-
333293if (IsA (cur_path ,AppendPath )&& pg_pathman_enable_runtimeappend )
334294inner_path = create_runtimeappend_path (root ,cur_path ,
335- ppi ,runtime_quals ,
336- paramsel );
295+ ppi ,paramsel );
337296else if (IsA (cur_path ,MergeAppendPath )&&
338297pg_pathman_enable_runtime_merge_append )
339298inner_path = create_runtimemergeappend_path (root ,cur_path ,
340- ppi ,runtime_quals ,
341- paramsel );
299+ ppi ,paramsel );
342300
343301if (inner_path )
344302add_path (rel ,inner_path );
345303}
346304}
347305}
306+
307+ void pg_pathman_enable_assign_hook (bool newval ,void * extra )
308+ {
309+ if (pg_pathman_enable == newval )
310+ return ;
311+
312+ pg_pathman_enable_runtime_merge_append = newval ;
313+ pg_pathman_enable_runtimeappend = newval ;
314+
315+ elog (NOTICE ,
316+ "RuntimeAppend and RuntimeMergeAppend nodes have been %s" ,
317+ newval ?"enabled" :"disabled" );
318+ }