Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CBRD-24658] Name binding error for SP in CTE and Aggregate statements #5234

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 28 additions & 30 deletions src/parser/method_transform.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,41 +352,39 @@ meth_translate_helper (PARSER_CONTEXT * parser, PT_NODE * node)
}
}

/* METHOD TRANSLATE */
/* put methods on the target entity spec's method list */
info2.methods_to_translate = 0;
info2.root = node;
(void) parser_walk_tree (parser, node, NULL, NULL, meth_create_method_list, &info2);

if (!info2.methods_to_translate)
{ /* not found method, do nothing */
break;
}
default:
break;
} /* switch (node->node_type) */

while (info2.methods_to_translate)
{
/* translate statement */
node = parser_walk_tree (parser, node, NULL, NULL, meth_translate_local, node);
/* error check */
if (pt_has_error (parser))
{ /* exit immediately */
goto exit_on_error;
}
/* METHOD TRANSLATE */
/* put methods on the target entity spec's method list */
info2.methods_to_translate = 0;
info2.root = node;
(void) parser_walk_tree (parser, node, NULL, NULL, meth_create_method_list, &info2);

/* Recalculate method_lists for nested method calls */
info2.methods_to_translate = 0;
info2.root = node;
(void) parser_walk_tree (parser, node, NULL, NULL, meth_create_method_list, &info2);
} /* while (info2.methods_to_translate) */
if (!info2.methods_to_translate)
{ /* not found method, do nothing */
return node;
}

/* collapse unnecessary SELECT/MERGE combinations */
node = parser_walk_tree (parser, node, NULL, NULL, meth_collapse_nodes, NULL);
while (info2.methods_to_translate)
{
/* translate statement */
node = parser_walk_tree (parser, node, NULL, NULL, meth_translate_local, node);
/* error check */
if (pt_has_error (parser))
{ /* exit immediately */
goto exit_on_error;
}

break;
/* Recalculate method_lists for nested method calls */
info2.methods_to_translate = 0;
info2.root = node;
(void) parser_walk_tree (parser, node, NULL, NULL, meth_create_method_list, &info2);
} /* while (info2.methods_to_translate) */

default:
break;
} /* switch (node->node_type) */
/* collapse unnecessary SELECT/MERGE combinations */
node = parser_walk_tree (parser, node, NULL, NULL, meth_collapse_nodes, NULL);

return node;

Expand Down
Loading