From 372371c25c6c2ad4151d790113285316f2247610 Mon Sep 17 00:00:00 2001 From: mhoh3963 Date: Thu, 8 Aug 2024 10:52:39 +0900 Subject: [PATCH] Revert "[CBRD-25316] For UPDATE JOIN statements, aggregate functions or analytic functions cannot be used in the SET and WHERE clauses (#5143)" This reverts commit 123d2628a16021af9ad36042557ab5db35b6d315. --- src/parser/semantic_check.c | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) diff --git a/src/parser/semantic_check.c b/src/parser/semantic_check.c index 80ba2b75cb3..3b3dfa1ebf8 100644 --- a/src/parser/semantic_check.c +++ b/src/parser/semantic_check.c @@ -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 @@ -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;