Skip to content

Commit c5d7951

Browse files
committed
disable inheritance for all subselects
1 parent 99052a6 commit c5d7951

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

pg_pathman.c

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ static Node *wrapper_make_expression(WrapperNode *wrap, int index, bool *alwaysT
7474
static void disable_inheritance(Query *parse);
7575
static void disable_inheritance_cte(Query *parse);
7676
static void disable_inheritance_subselect(Query *parse);
77+
static bool disable_inheritance_subselect_walker(Node *node, void *context);
7778

7879
/* Expression tree handlers */
7980
static Datum increase_hashable_value(const PartRelationInfo *prel, Datum value);
@@ -388,13 +389,22 @@ disable_inheritance_subselect(Query *parse)
388389
return;
389390

390391
quals = parse->jointree->quals;
391-
if (!IsA(quals, SubLink))
392-
return;
392+
disable_inheritance_subselect_walker(quals, NULL);
393+
}
393394

394-
if (!IsA(((SubLink *) quals)->subselect, Query))
395-
return;
395+
static bool
396+
disable_inheritance_subselect_walker(Node *node, void *context)
397+
{
398+
if (node == NULL)
399+
return false;
400+
401+
if (IsA(node, SubLink))
402+
{
403+
disable_inheritance((Query *) (((SubLink *) node)->subselect));
404+
return false;
405+
}
396406

397-
disable_inheritance((Query *) (((SubLink *) quals)->subselect));
407+
return expression_tree_walker(node, disable_inheritance_subselect_walker, (void *) context);
398408
}
399409

400410
/*

0 commit comments

Comments
 (0)