diff --git a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp index 7ff51eff6a..eee1949efb 100644 --- a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp +++ b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.cpp @@ -5817,7 +5817,7 @@ int ObRawExprResolverImpl::process_fun_sys_node(const ParseNode *node, ObRawExpr } if (OB_SUCC(ret)) { - if (OB_FAIL(process_sys_func_params(*func_expr))) { + if (OB_FAIL(process_sys_func_params(*func_expr, current_columns_count))) { LOG_WARN("fail process sys func params", K(ret)); } } @@ -5867,12 +5867,19 @@ int ObRawExprResolverImpl::process_fun_sys_node(const ParseNode *node, ObRawExpr return ret; } -int ObRawExprResolverImpl::process_sys_func_params(ObSysFunRawExpr &func_expr) +int ObRawExprResolverImpl::process_sys_func_params(ObSysFunRawExpr &func_expr, int current_columns_count) { int ret = OB_SUCCESS; const ObExprOperatorType expr_type = ObExprOperatorFactory::get_type_by_name(func_expr.get_func_name()); switch (expr_type) { + case T_FUN_SYS_NAME_CONST: + if (current_columns_count != ctx_.columns_->count()) { + ret = OB_INVALID_ARGUMENT; + LOG_USER_ERROR(OB_INVALID_ARGUMENT, N_NAME_CONST); + LOG_WARN("params of name_const contain column references", K(ret)); + } + break; case T_FUN_SYS_UUID2BIN: case T_FUN_SYS_BIN2UUID: if (2 == func_expr.get_param_count()) { diff --git a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.h b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.h index d1b35e8b93..095a9a99b2 100644 --- a/src/sql/resolver/expr/ob_raw_expr_resolver_impl.h +++ b/src/sql/resolver/expr/ob_raw_expr_resolver_impl.h @@ -202,7 +202,7 @@ private: const ParseNode *expr_node, ObRawExpr *&expr); private: - int process_sys_func_params(ObSysFunRawExpr &func_expr); + int process_sys_func_params(ObSysFunRawExpr &func_expr, int current_columns_count); int transform_ratio_afun_to_arg_div_sum(const ParseNode *ratio_to_report, ParseNode *&div); int convert_any_or_all_expr(ObRawExpr *&expr, bool &happened); int get_opposite_string(const common::ObString &orig_string, common::ObString &new_string, common::ObIAllocator &allocator);