Skip to content

Commit 98d44c0

Browse files
committed
check for all param types in rel_pathlist_hook, fixes
1 parent c4b0063 commit 98d44c0

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

hooks.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,11 @@ pathman_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, RangeTb
272272
quals = extract_actual_clauses(child_rel->baserestrictinfo, false);
273273

274274
/* Do not proceed if there's a rel containing quals without params */
275-
if (!clause_contains_extern_params((Node *) quals))
275+
if (!clause_contains_params((Node *) quals))
276+
{
277+
picky_quals = NIL; /* skip this path */
276278
break;
279+
}
277280

278281
/* Replace child Vars with a parent rel's Var */
279282
quals = (List *) replace_child_vars_with_parent_var((Node *) quals,

utils.c

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,25 @@
55
#include "rewrite/rewriteManip.h"
66

77

8-
static bool clause_contains_extern_params_walker(Node *node, void *context);
8+
static bool clause_contains_params_walker(Node *node, void *context);
99

1010
bool
11-
clause_contains_extern_params(Node *clause)
11+
clause_contains_params(Node *clause)
1212
{
1313
return expression_tree_walker(clause,
14-
clause_contains_extern_params_walker,
14+
clause_contains_params_walker,
1515
NULL);
1616
}
1717

1818
static bool
19-
clause_contains_extern_params_walker(Node *node, void *context)
19+
clause_contains_params_walker(Node *node, void *context)
2020
{
2121
if (node == NULL)
2222
return false;
2323
if (IsA(node, Param))
24-
{
25-
Param *param = (Param *) node;
26-
27-
if (param->paramkind == PARAM_EXTERN)
28-
return true;
29-
return false;
30-
}
24+
return true;
3125
return expression_tree_walker(node,
32-
clause_contains_extern_params_walker,
26+
clause_contains_params_walker,
3327
context);
3428
}
3529

utils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ typedef struct
1212
int sublevels_up;
1313
} ReplaceVarsContext;
1414

15-
bool clause_contains_extern_params(Node *clause);
15+
bool clause_contains_params(Node *clause);
1616

1717
Node * replace_child_vars_with_parent_var(Node *node,
1818
ReplaceVarsContext *context);

0 commit comments

Comments
 (0)