Skip to content

Commit

Permalink
teach pull_(varno|varattno)_walker about RestrictInfo
Browse files Browse the repository at this point in the history
otherwise pull_varnos fails when processing OR clauses
  • Loading branch information
tvondra committed Jun 15, 2015
1 parent a850541 commit 2dc79b9
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/backend/optimizer/util/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,13 @@ pull_varnos_walker(Node *node, pull_varnos_context *context)
context->sublevels_up--;
return result;
}
if (IsA(node, RestrictInfo))
{
RestrictInfo *rinfo = (RestrictInfo*)node;
context->varnos = bms_add_members(context->varnos,
rinfo->clause_relids);
return false;
}
return expression_tree_walker(node, pull_varnos_walker,
(void *) context);
}
Expand Down Expand Up @@ -245,6 +252,15 @@ pull_varattnos_walker(Node *node, pull_varattnos_context *context)
return false;
}

if (IsA(node, RestrictInfo))
{
RestrictInfo *rinfo = (RestrictInfo *)node;

return expression_tree_walker((Node*)rinfo->clause,
pull_varattnos_walker,
(void*) context);
}

/* Should not find an unplanned subquery */
Assert(!IsA(node, Query));

Expand Down

0 comments on commit 2dc79b9

Please sign in to comment.