Skip to content

Commit

Permalink
[CBRD-24658] Name binding error for SP in CTE and Aggregate statements (
Browse files Browse the repository at this point in the history
  • Loading branch information
beyondykk9 committed Jul 12, 2024
1 parent 4017adf commit 520d0ad
Showing 1 changed file with 28 additions and 30 deletions.
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

0 comments on commit 520d0ad

Please sign in to comment.