-
Notifications
You must be signed in to change notification settings - Fork 96
Open
Description
HI hackers,
there is some improper handing in function view_walker() in file src/utils/pool_select_walker.c
when node is RangeVar and it is a view, ctx->has_view is set to true, then return false, return false here is not reasonable, it should return true, since we have got the result that there is a view existed, so raw_expression_tree_walker() is not necessary to continue to traverse other nodes, should stop Immediately, that can save cost.
Similar other functions also have this problem, such like function_call_walker()/system_catalog_walker()/temp_table_walker()/unlogged_table_walker()/row_security_enabled_walker().
please help check that.
static bool
view_walker(Node *node, void *context)
{
SelectContext *ctx = (SelectContext *) context;
char *relname;
if (node == NULL)
return false;
if (IsA(node, RangeVar))
{
RangeVar *rgv = (RangeVar *) node;
relname = make_table_name_from_rangevar(rgv);
ereport(DEBUG1,
(errmsg("view walker. checking relation \"%s\"", relname)));
if (is_view(relname))
{
ctx->has_view = true;
return false;
}
}
return raw_expression_tree_walker(node, view_walker, context);
}
thanks a lot!
liujinyang
Metadata
Metadata
Assignees
Labels
No labels