Skip to content

Commit

Permalink
Revert "[CBRD-25316] For UPDATE JOIN statements, aggregate functions …
Browse files Browse the repository at this point in the history
…or analytic functions cannot be used in the SET and WHERE clauses (CUBRID#5143)"

This reverts commit 123d262.
  • Loading branch information
mhoh3963 committed Aug 8, 2024
1 parent 611815b commit 372371c
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/parser/semantic_check.c
Original file line number Diff line number Diff line change
Expand Up @@ -4377,15 +4377,13 @@ pt_find_aggregate_analytic_post (PARSER_CONTEXT * parser, PT_NODE * tree, void *
* [Note]
* This function will search whether an aggregate or analytic function exists
* in WHERE clause of below statements:
* INSERT, UPDATE, DO, SET, DELETE, SELECT, UNION, DIFFERENCE, INTERSECTION, and
* INSERT, DO, SET, DELETE, SELECT, UNION, DIFFERENCE, INTERSECTION, and
* MERGE.
* It stops searching when meets the first aggregate or analytic function.
*
* 1) For below node types, searching is limited to child node who containing
* SET clause:
* PT_UPDATE
* WHERE clause:
* PT_DO, PT_DELETE, PT_SET_SESSION_VARIABLES, PT_SELECT, PT_UPDATE
* PT_DO, PT_DELETE, PT_SET_SESSION_VARIABLES, PT_SELECT
*
* 2) For below node types, searching is executed on its args:
* PT_UNION, PT_DIFFERENCE, PT_INTERSECTION
Expand Down Expand Up @@ -4451,24 +4449,6 @@ pt_find_aggregate_analytic_in_where (PARSER_CONTEXT * parser, PT_NODE * node)
&find);
break;

case PT_UPDATE:
/* For UPDATE JOIN statements, aggregate functions or analytic functions cannot be used
* in the SET and WHERE clauses. Aggregate functions cannot be used in the UPDATE statement,
* even if it is not an UPDATE JOIN statement. Whether aggregate functions are used is checked
* in the pt_semantic_check_local function.
*/
if (node->info.update.spec->next != NULL)
{
find = pt_find_aggregate_analytic_in_where (parser, node->info.update.assignment);
if (find != NULL)
{
break;
}

find = pt_find_aggregate_analytic_in_where (parser, node->info.update.search_cond);
}
break;

default:
/* for the rest node types, no need to search */
break;
Expand Down

0 comments on commit 372371c

Please sign in to comment.