diff --git a/src/share/ob_errno.cpp b/src/share/ob_errno.cpp index 8a693db005..be9400fe02 100755 --- a/src/share/ob_errno.cpp +++ b/src/share/ob_errno.cpp @@ -14751,8 +14751,8 @@ static const _error _error_OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE = { .error_solution = "Contact OceanBase Support", .mysql_errno = ER_CTE_RECURSIVE_REQUIRES_UNION, .sqlstate = "HY000", - .str_error = "recursive WITH clause must use a UNION ALL operation", - .str_user_error = "recursive WITH clause must use a UNION ALL operation", + .str_error = "Recursive Common Table Expression should contain a UNION ALL", + .str_user_error = "Recursive Common Table Expression should contain a UNION ALL", .oracle_errno = 32040, .oracle_str_error = "ORA-32040: recursive WITH clause must use a UNION ALL operation", .oracle_str_user_error = "ORA-32040: recursive WITH clause must use a UNION ALL operation" @@ -14763,8 +14763,8 @@ static const _error _error_OB_ERR_NEED_ONLY_TWO_BRANCH_IN_RECURSIVE_CTE = { .error_solution = "Contact OceanBase Support", .mysql_errno = -1, .sqlstate = "HY000", - .str_error = "UNION ALL operation in recursive WITH clause must have only two branches", - .str_user_error = "UNION ALL operation in recursive WITH clause must have only two branches", + .str_error = "More than one recursive query blocks of Common Table Expression not supported", + .str_user_error = "More than one recursive query blocks of Common Table Expression not supported", .oracle_errno = 32041, .oracle_str_error = "ORA-32041: UNION ALL operation in recursive WITH clause must have only two branches", .oracle_str_user_error = "ORA-32041: UNION ALL operation in recursive WITH clause must have only two branches" @@ -14943,8 +14943,8 @@ static const _error _error_OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH = { .error_solution = "Contact OceanBase Support", .mysql_errno = ER_CTE_RECURSIVE_FORBIDS_AGGREGATION, .sqlstate = "HY000", - .str_error = "Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block", - .str_user_error = "Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block", + .str_error = "ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported", + .str_user_error = "ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported", .oracle_errno = 32486, .oracle_str_error = "ORA-32486: unsupported operation in recursive branch of recursive WITH clause", .oracle_str_user_error = "ORA-32486: unsupported operation in recursive branch of recursive WITH clause" diff --git a/src/share/ob_errno.def b/src/share/ob_errno.def index 04ec5dec31..be8630d9d7 100755 --- a/src/share/ob_errno.def +++ b/src/share/ob_errno.def @@ -1351,8 +1351,8 @@ DEFINE_ORACLE_ERROR(OB_ERR_CTE_UNSUPPORTED_COLUMN_ALIASING, -5738, -1, "HY000", DEFINE_ORACLE_ERROR(OB_ERR_UNSUPPORTED_USE_OF_CTE, -5739, -1, "HY000", "unsupported use of WITH clause", 32034, "unsupported use of WITH clause"); DEFINE_ORACLE_ERROR(OB_ERR_CTE_COLUMN_NUMBER_NOT_MATCH, -5740, ER_VIEW_WRONG_LIST, "HY000", "View's SELECT and view's field list have different column counts", 32038, "number of WITH clause column names does not match number of elements in select list"); DEFINE_ORACLE_ERROR(OB_ERR_NEED_COLUMN_ALIAS_LIST_IN_RECURSIVE_CTE, -5741, -1, "HY000", "recursive WITH clause must have column alias list", 32039, "recursive WITH clause must have column alias list"); -DEFINE_ORACLE_ERROR(OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE, -5742, ER_CTE_RECURSIVE_REQUIRES_UNION, "HY000", "recursive WITH clause must use a UNION ALL operation", 32040, "recursive WITH clause must use a UNION ALL operation"); -DEFINE_ORACLE_ERROR(OB_ERR_NEED_ONLY_TWO_BRANCH_IN_RECURSIVE_CTE, -5743, -1, "HY000", "UNION ALL operation in recursive WITH clause must have only two branches", 32041, "UNION ALL operation in recursive WITH clause must have only two branches"); +DEFINE_ORACLE_ERROR(OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE, -5742, ER_CTE_RECURSIVE_REQUIRES_UNION, "HY000", "Recursive Common Table Expression should contain a UNION ALL", 32040, "recursive WITH clause must use a UNION ALL operation"); +DEFINE_ORACLE_ERROR(OB_ERR_NEED_ONLY_TWO_BRANCH_IN_RECURSIVE_CTE, -5743, -1, "HY000", "More than one recursive query blocks of Common Table Expression not supported", 32041, "UNION ALL operation in recursive WITH clause must have only two branches"); DEFINE_ORACLE_ERROR(OB_ERR_NEED_REFERENCE_ITSELF_DIRECTLY_IN_RECURSIVE_CTE, -5744, ER_CTE_RECURSIVE_REQUIRES_SINGLE_REFERENCE, "HY000", "In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery", 32042, "recursive WITH clause must reference itself directly in one of the UNION ALL branches"); DEFINE_ORACLE_ERROR(OB_ERR_NEED_INIT_BRANCH_IN_RECURSIVE_CTE, -5745, -1, "HY000", "recursive WITH clause needs an initialization branch", 32043, "recursive WITH clause needs an initialization branch"); DEFINE_ORACLE_ERROR(OB_ERR_CYCLE_FOUND_IN_RECURSIVE_CTE, -5746, -1, "HY000", "cycle detected while executing recursive WITH query", 32044, "cycle detected while executing recursive WITH query"); @@ -1367,7 +1367,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_CTE_DUPLICATE_SEQ_NAME_CYCLE_COLUMN, -5754, -1, "HY00 DEFINE_ORACLE_ERROR(OB_ERR_CTE_DUPLICATE_NAME_IN_SEARCH_CLAUSE, -5755, -1, "HY000", "duplicate name found in sort specification list for SEARCH clause of WITH clause", 32483, "duplicate name found in sort specification list for SEARCH clause of WITH clause"); DEFINE_ORACLE_ERROR(OB_ERR_CTE_DUPLICATE_NAME_IN_CYCLE_CLAUSE, -5756, -1, "HY000", "duplicate name found in cycle column list for CYCLE clause of WITH clause", 32484, "duplicate name found in cycle column list for CYCLE clause of WITH clause"); DEFINE_ORACLE_ERROR(OB_ERR_CTE_ILLEGAL_COLUMN_IN_CYCLE_CLAUSE, -5757, -1, "HY000", "element in cycle column list of CYCLE clause must appear in the column alias list of the WITH clause element", 32485, "element in cycle column list of CYCLE clause must appear in the column alias list of the WITH clause element"); -DEFINE_ORACLE_ERROR(OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH, -5758, ER_CTE_RECURSIVE_FORBIDS_AGGREGATION, "HY000", "Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block", 32486, "unsupported operation in recursive branch of recursive WITH clause"); +DEFINE_ORACLE_ERROR(OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH, -5758, ER_CTE_RECURSIVE_FORBIDS_AGGREGATION, "HY000", "ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported", 32486, "unsupported operation in recursive branch of recursive WITH clause"); DEFINE_ORACLE_ERROR(OB_ERR_ILLEGAL_JOIN_IN_RECURSIVE_CTE, -5759, ER_CTE_RECURSIVE_FORBIDDEN_JOIN_ORDER, "HY000", "In recursive query block of Recursive Common Table Expression, the recursive table must neither be in the right argument of a LEFT JOIN, nor be forced to be non-first with join order hints", 32487, "unsupported join in recursive WITH query"); DEFINE_ORACLE_ERROR(OB_ERR_CTE_NEED_COLUMN_ALIAS_LIST, -5760, -1, "HY000", "WITH clause element did not have a column alias list", 32488, "WITH clause element did not have a column alias list"); DEFINE_ORACLE_ERROR(OB_ERR_CTE_ILLEGAL_COLUMN_IN_SERACH_CALUSE, -5761, -1, "HY000", "element in sort specification list of SEARCH clause did not appear in the column alias list of the WITH clause element", 32489, "element in sort specification list of SEARCH clause did not appear in the column alias list of the WITH clause element"); diff --git a/src/share/ob_errno.h b/src/share/ob_errno.h index 6a2e34c55d..8ce2c9b4d5 100755 --- a/src/share/ob_errno.h +++ b/src/share/ob_errno.h @@ -3002,8 +3002,8 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219; #define OB_ERR_UNSUPPORTED_USE_OF_CTE__USER_ERROR_MSG "unsupported use of WITH clause" #define OB_ERR_CTE_COLUMN_NUMBER_NOT_MATCH__USER_ERROR_MSG "View's SELECT and view's field list have different column counts" #define OB_ERR_NEED_COLUMN_ALIAS_LIST_IN_RECURSIVE_CTE__USER_ERROR_MSG "recursive WITH clause must have column alias list" -#define OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE__USER_ERROR_MSG "recursive WITH clause must use a UNION ALL operation" -#define OB_ERR_NEED_ONLY_TWO_BRANCH_IN_RECURSIVE_CTE__USER_ERROR_MSG "UNION ALL operation in recursive WITH clause must have only two branches" +#define OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE__USER_ERROR_MSG "Recursive Common Table Expression should contain a UNION ALL" +#define OB_ERR_NEED_ONLY_TWO_BRANCH_IN_RECURSIVE_CTE__USER_ERROR_MSG "More than one recursive query blocks of Common Table Expression not supported" #define OB_ERR_NEED_REFERENCE_ITSELF_DIRECTLY_IN_RECURSIVE_CTE__USER_ERROR_MSG "In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery" #define OB_ERR_NEED_INIT_BRANCH_IN_RECURSIVE_CTE__USER_ERROR_MSG "recursive WITH clause needs an initialization branch" #define OB_ERR_CYCLE_FOUND_IN_RECURSIVE_CTE__USER_ERROR_MSG "cycle detected while executing recursive WITH query" @@ -3018,7 +3018,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219; #define OB_ERR_CTE_DUPLICATE_NAME_IN_SEARCH_CLAUSE__USER_ERROR_MSG "duplicate name found in sort specification list for SEARCH clause of WITH clause" #define OB_ERR_CTE_DUPLICATE_NAME_IN_CYCLE_CLAUSE__USER_ERROR_MSG "duplicate name found in cycle column list for CYCLE clause of WITH clause" #define OB_ERR_CTE_ILLEGAL_COLUMN_IN_CYCLE_CLAUSE__USER_ERROR_MSG "element in cycle column list of CYCLE clause must appear in the column alias list of the WITH clause element" -#define OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH__USER_ERROR_MSG "Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block" +#define OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH__USER_ERROR_MSG "ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported" #define OB_ERR_ILLEGAL_JOIN_IN_RECURSIVE_CTE__USER_ERROR_MSG "In recursive query block of Recursive Common Table Expression, the recursive table must neither be in the right argument of a LEFT JOIN, nor be forced to be non-first with join order hints" #define OB_ERR_CTE_NEED_COLUMN_ALIAS_LIST__USER_ERROR_MSG "WITH clause element did not have a column alias list" #define OB_ERR_CTE_ILLEGAL_COLUMN_IN_SERACH_CALUSE__USER_ERROR_MSG "element in sort specification list of SEARCH clause did not appear in the column alias list of the WITH clause element" diff --git a/src/sql/optimizer/ob_optimizer_util.cpp b/src/sql/optimizer/ob_optimizer_util.cpp index 46e724a591..685869da7f 100644 --- a/src/sql/optimizer/ob_optimizer_util.cpp +++ b/src/sql/optimizer/ob_optimizer_util.cpp @@ -5957,7 +5957,8 @@ int ObOptimizerUtil::gen_set_target_list(ObIAllocator *allocator, ObSelectStmt &left_stmt, ObSelectStmt &right_stmt, ObSelectStmt *select_stmt, - const bool to_left_type /* false */) + const bool is_mysql_recursive_union /* false */, + ObIArray *rcte_col_name /* null */) { int ret = OB_SUCCESS; ObSEArray left_stmts; @@ -5965,7 +5966,8 @@ int ObOptimizerUtil::gen_set_target_list(ObIAllocator *allocator, if (OB_FAIL(left_stmts.push_back(&left_stmt)) || OB_FAIL(right_stmts.push_back(&right_stmt))) { LOG_WARN("failed to pushback stmt", K(ret)); } else if (OB_FAIL(gen_set_target_list(allocator, session_info, expr_factory, - left_stmts, right_stmts, select_stmt, to_left_type))) { + left_stmts, right_stmts, select_stmt, is_mysql_recursive_union, + rcte_col_name))) { LOG_WARN("failed to get set target list", K(ret)); } return ret; @@ -5977,7 +5979,8 @@ int ObOptimizerUtil::gen_set_target_list(ObIAllocator *allocator, ObIArray &left_stmts, ObIArray &right_stmts, ObSelectStmt *select_stmt, - const bool to_left_type /* false */) + const bool is_mysql_recursive_union /* false */, + ObIArray *rcte_col_name /* null */) { int ret = OB_SUCCESS; UNUSED(allocator); @@ -5989,7 +5992,7 @@ int ObOptimizerUtil::gen_set_target_list(ObIAllocator *allocator, } else if (OB_FAIL(try_add_cast_to_set_child_list(allocator, session_info, expr_factory, select_stmt->is_set_distinct(), left_stmts, right_stmts, &res_types, - to_left_type))) { + is_mysql_recursive_union, rcte_col_name))) { LOG_WARN("failed to try add cast to set child list", K(ret)); } else if (OB_ISNULL(child_stmt = select_stmt->get_set_query(0)) || OB_UNLIKELY(res_types.count() != child_stmt->get_select_item_size())) { @@ -6179,7 +6182,8 @@ int ObOptimizerUtil::try_add_cast_to_set_child_list(ObIAllocator *allocator, ObIArray &left_stmts, ObIArray &right_stmts, ObIArray *res_types, - const bool to_left_type /* false */) + const bool is_mysql_recursive_union /* false */, + ObIArray *rcte_col_name /* null */) { int ret = OB_SUCCESS; ObExprResType res_type; @@ -6211,7 +6215,7 @@ int ObOptimizerUtil::try_add_cast_to_set_child_list(ObIAllocator *allocator, left_type.unset_result_flag(NOT_NULL_FLAG); right_type.unset_result_flag(NOT_NULL_FLAG); } - if (left_type != right_type || ob_is_enumset_tc(right_type.get_type())) { + if (left_type != right_type || ob_is_enumset_tc(right_type.get_type()) || is_mysql_recursive_union) { ObSEArray types; ObExprVersion dummy_op(*allocator); ObCollationType coll_type = CS_TYPE_INVALID; @@ -6271,7 +6275,15 @@ int ObOptimizerUtil::try_add_cast_to_set_child_list(ObIAllocator *allocator, } const ObLengthSemantics length_semantics = session_info->get_actual_nls_length_semantics(); if (OB_FAIL(ret)) { - } else if (to_left_type || skip_add_cast) { + } else if (is_mysql_recursive_union) { + if (left_type.is_null()) { + res_type.set_binary(); + res_type.set_length(0); + res_type.set_collation_level(CS_LEVEL_IMPLICIT); + } else { + res_type = left_type; + } + } else if (skip_add_cast) { res_type = left_type; } else if (OB_FAIL(types.push_back(left_type)) || OB_FAIL(types.push_back(right_type))) { LOG_WARN("failed to push back", K(ret)); @@ -6294,9 +6306,14 @@ int ObOptimizerUtil::try_add_cast_to_set_child_list(ObIAllocator *allocator, } else if (left_type != res_type && OB_FAIL(add_cast_to_set_list(session_info, expr_factory, left_stmts, res_type, i))) { LOG_WARN("failed to add add cast to set list", K(ret)); - } else if (right_type != res_type && OB_FAIL(add_cast_to_set_list(session_info, + } else if (!is_mysql_recursive_union && + right_type != res_type && OB_FAIL(add_cast_to_set_list(session_info, expr_factory, right_stmts, res_type, i))) { LOG_WARN("failed to add add cast to set list", K(ret)); + } else if (is_mysql_recursive_union && + OB_FAIL(add_column_conv_to_set_list(session_info, expr_factory, right_stmts, + res_type, i, rcte_col_name))) { + LOG_WARN("failed to add column_conv to set list", K(ret)); } } else if (lib::is_oracle_mode() && is_distinct && (left_type.is_lob() || left_type.is_lob_locator())) { @@ -6337,16 +6354,23 @@ int ObOptimizerUtil::add_cast_to_set_list(ObSQLSessionInfo *session_info, ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected stmt", K(ret), K(stmts.at(i))); } else if (ob_is_enumset_tc(src_expr->get_result_type().get_type())) { - ObSysFunRawExpr *cast_expr = NULL; + ObSysFunRawExpr *to_str_expr = NULL; if (src_expr->get_result_type() == res_type) { /*do nothing*/ - } else if (OB_FAIL(ObRawExprUtils::create_cast_expr(*expr_factory, src_expr, res_type, - cast_expr, session_info))) { + } else if (OB_FAIL(ObRawExprUtils::create_type_to_str_expr(*expr_factory, + src_expr, + to_str_expr, + session_info, + true))) { + LOG_WARN("create to str expr for stmt failed", K(ret)); + } else if (OB_FAIL(ObRawExprUtils::try_add_cast_expr_above(expr_factory, session_info, + *to_str_expr, res_type, + new_expr))) { LOG_WARN("create cast expr for stmt failed", K(ret)); - } else if (OB_FAIL(cast_expr->add_flag(IS_INNER_ADDED_EXPR))) { + } else if (OB_FAIL(new_expr->add_flag(IS_INNER_ADDED_EXPR))) { LOG_WARN("failed to add flag", K(ret)); } else { - stmt->get_select_item(idx).expr_ = cast_expr; + stmt->get_select_item(idx).expr_ = new_expr; } } else if (OB_FAIL(ObRawExprUtils::try_add_cast_expr_above(expr_factory, session_info, *src_expr, res_type, @@ -6363,6 +6387,42 @@ int ObOptimizerUtil::add_cast_to_set_list(ObSQLSessionInfo *session_info, return ret; } +int ObOptimizerUtil::add_column_conv_to_set_list(ObSQLSessionInfo *session_info, + ObRawExprFactory *expr_factory, + ObIArray &stmts, + const ObExprResType &res_type, + const int64_t idx, + ObIArray *rcte_col_name) +{ + int ret = OB_SUCCESS; + ObRawExpr *src_expr = NULL; + ObRawExpr *new_expr = NULL; + ObSelectStmt *stmt = NULL; + const int64_t num = stmts.count(); + if (OB_ISNULL(session_info) || OB_ISNULL(expr_factory)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected null", K(ret)); + } + for (int64_t i = 0; OB_SUCC(ret) && i < num; ++i) { + if (OB_ISNULL(stmt = stmts.at(i)) || idx >= stmt->get_select_item_size() + || OB_ISNULL(src_expr = stmt->get_select_item(idx).expr_)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected stmt", K(ret), K(stmts.at(i))); + } else if (OB_FAIL(ObRawExprUtils::build_column_conv_expr(session_info, + *expr_factory, + res_type.get_type(), + res_type.get_collation_type(), + res_type.get_accuracy().get_accuracy(), + true, + NULL != rcte_col_name ? &rcte_col_name->at(idx) : NULL, + NULL, + stmt->get_select_item(idx).expr_))) { + LOG_WARN("failed to build column conv expr", K(ret)); + } + } + return ret; +} + /** * check_subquery_has_ref_assign_user_var * 检查expr的子查询中是否包含涉及到赋值操作的用户变量 diff --git a/src/sql/optimizer/ob_optimizer_util.h b/src/sql/optimizer/ob_optimizer_util.h index 79cdbda716..07547ead77 100644 --- a/src/sql/optimizer/ob_optimizer_util.h +++ b/src/sql/optimizer/ob_optimizer_util.h @@ -1079,7 +1079,8 @@ public: ObSelectStmt &left_stmt, ObSelectStmt &right_stmt, ObSelectStmt *select_stmt, - const bool to_left_type = false); + const bool is_mysql_recursive_union = false, + ObIArray *rcte_col_name = NULL); static int gen_set_target_list(ObIAllocator *allocator, ObSQLSessionInfo *session_info, @@ -1087,7 +1088,8 @@ public: ObIArray &left_stmts, ObIArray &right_stmts, ObSelectStmt *select_stmt, - const bool to_left_type = false); + const bool is_mysql_recursive_union = false, + ObIArray *rcte_col_name = NULL); static int gen_set_target_list(ObIAllocator *allocator, ObSQLSessionInfo *session_info, @@ -1106,7 +1108,8 @@ public: ObIArray &left_stmts, ObIArray &right_stmts, ObIArray *res_types, - const bool to_left_type = false); + const bool is_mysql_recursive_union = false, + ObIArray *rcte_col_name = NULL); static int add_cast_to_set_list(ObSQLSessionInfo *session_info, ObRawExprFactory *expr_factory, @@ -1114,6 +1117,13 @@ public: const ObExprResType &res_type, const int64_t idx); + static int add_column_conv_to_set_list(ObSQLSessionInfo *session_info, + ObRawExprFactory *expr_factory, + ObIArray &stmts, + const ObExprResType &res_type, + const int64_t idx, + ObIArray *rcte_col_name); + static int check_subquery_has_ref_assign_user_var(ObRawExpr *expr, bool &is_has); /** diff --git a/src/sql/resolver/dml/ob_dml_resolver.cpp b/src/sql/resolver/dml/ob_dml_resolver.cpp index bcd96717c7..49764524fb 100755 --- a/src/sql/resolver/dml/ob_dml_resolver.cpp +++ b/src/sql/resolver/dml/ob_dml_resolver.cpp @@ -10870,6 +10870,11 @@ int ObDMLResolver::add_cte_table_to_children(ObChildStmtResolver& child_resolver } else { } } + for (int64_t i = 0; OB_SUCC(ret) && i < parent_cte_tables_.count(); i++) { + if (OB_FAIL(child_resolver.add_parent_cte_table_item(parent_cte_tables_.at(i)))) { + LOG_WARN("add parent cte table to children failed", K(ret)); + } + } return ret; } @@ -14043,24 +14048,24 @@ int ObDMLResolver::add_parent_cte_table_to_children(ObChildStmtResolver &child_r return ret; } -int ObDMLResolver::check_CTE_name_exist(const ObString &var_name, bool &exist){ +int ObDMLResolver::check_current_CTE_name_exist(const ObString &var_name, bool &exist){ int ret = OB_SUCCESS; exist = false; - //优先找自己本层定义的CTE table for (int64_t i = 0; !exist && i < current_cte_tables_.count(); i++) { - if (ObCharset::case_insensitive_equal(current_cte_tables_[i]->table_name_, var_name)) { + if (OB_NOT_NULL(current_cte_tables_[i]) && + ObCharset::case_insensitive_equal(current_cte_tables_[i]->table_name_, var_name)) { exist = true; } } return ret; } -int ObDMLResolver::check_CTE_name_exist(const ObString &var_name, bool &exist, TableItem *&table_item){ +int ObDMLResolver::check_current_CTE_name_exist(const ObString &var_name, bool &exist, TableItem *&table_item){ int ret = OB_SUCCESS; exist = false; - //优先找自己本层定义的CTE table for (int64_t i = 0; !exist && i < current_cte_tables_.count(); i++) { - if (ObCharset::case_insensitive_equal(current_cte_tables_[i]->table_name_, var_name)) { + if (OB_NOT_NULL(current_cte_tables_[i]) && + ObCharset::case_insensitive_equal(current_cte_tables_[i]->table_name_, var_name)) { exist = true; table_item = current_cte_tables_[i]; } @@ -14068,6 +14073,31 @@ int ObDMLResolver::check_CTE_name_exist(const ObString &var_name, bool &exist, T return ret; } +int ObDMLResolver::check_parent_CTE_name_exist(const ObString &var_name, bool &exist){ + int ret = OB_SUCCESS; + exist = false; + for (int64_t i = 0; !exist && i < parent_cte_tables_.count(); i++) { + if (OB_NOT_NULL(parent_cte_tables_[i]) && + ObCharset::case_insensitive_equal(parent_cte_tables_[i]->table_name_, var_name)) { + exist = true; + } + } + return ret; +} + +int ObDMLResolver::check_parent_CTE_name_exist(const ObString &var_name, bool &exist, TableItem *&table_item){ + int ret = OB_SUCCESS; + exist = false; + for (int64_t i = 0; !exist && i < parent_cte_tables_.count(); i++) { + if (OB_NOT_NULL(parent_cte_tables_[i]) && + ObCharset::case_insensitive_equal(parent_cte_tables_[i]->table_name_, var_name)) { + exist = true; + table_item = parent_cte_tables_[i]; + } + } + return ret; +} + int ObDMLResolver::set_cte_ctx(ObCteResolverCtx& cte_ctx, bool copy_col_name /*true*/, bool in_subquery /*false*/) @@ -14173,8 +14203,6 @@ int ObDMLResolver::init_cte_resolver(ObSelectResolver &select_resolver, /* 把当前的cte定义表名传入子resolver,用于判断后续是否是递归类的cte */ if (OB_FAIL(add_cte_table_to_children(select_resolver))) { LOG_WARN("failed to resolve with clause", K(ret)); - } else if (OB_FAIL(add_parent_cte_table_to_children(select_resolver))) { - LOG_WARN("failed to add parent cte table to children", K(ret)); } } return ret; @@ -14240,8 +14268,19 @@ int ObDMLResolver::add_fake_schema(ObSelectStmt *left_stmt) new_col->set_meta_type(expr->get_result_type()); new_col->set_accuracy(expr->get_accuracy()); new_col->set_collation_type(select_expr->get_collation_type()); + new_col->set_extended_type_info(expr->get_enum_set_values()); new_col->add_column_flag(CTE_GENERATED_COLUMN_FLAG); - tbl_schema->add_column(*new_col); + if (OB_FAIL(tbl_schema->add_column(*new_col))) { + LOG_WARN("failed to add column", K(ret), KPC(new_col)); + if (OB_ERR_COLUMN_DUPLICATE == ret) { + if (lib::is_oracle_mode()) { + ret = OB_ERR_CTE_COLUMN_ALIAS_DUPLICATE; + } else { + ObString &name = cte_ctx_.cte_col_names_.at(i); + LOG_USER_ERROR(OB_ERR_COLUMN_DUPLICATE, name.length(), name.ptr()); + } + } + } //因为table schema内部会深度拷贝一次,所以这个在外部一定要释放 allocator_->free(new_col); //ob_free(new_col); @@ -14288,18 +14327,28 @@ int ObDMLResolver::resolve_basic_table_with_cte(const ParseNode &parse_tree, Tab table_node = parse_tree.children_[0]; } no_defined_database_name = (table_node->children_[0] == NULL); - //查找顺序:先查找递归cte,再查找cte,最后查找正常的表 + //查找顺序:先查找本层cte,再查找递归cte,再查找外层cte,最后查找正常的表 ObString tblname(table_node->str_len_, table_node->str_value_); - if (cte_ctx_.is_with_resolver() + if (OB_FAIL(check_current_CTE_name_exist(tblname, find_CTE_name, table_item))) { + LOG_WARN("check CTE duplicate name failed", K(ret)); + } else if (find_CTE_name && no_defined_database_name) { + TableItem* CTE_table_item = table_item; + table_item = NULL; + if (OB_FAIL(resolve_cte_table(parse_tree, CTE_table_item, table_item))) { + LOG_WARN("failed to resolve CTE table", K(ret)); + } else if (OB_ISNULL(table_item)) { + table_item = CTE_table_item; + ret = OB_ERR_UNEXPECTED; + LOG_WARN("failed to resolve CTE table", K(ret)); + } + } else if ((is_oracle_mode() || params_.has_recursive_word_) + && cte_ctx_.is_with_resolver() && ObCharset::case_insensitive_equal(cte_ctx_.current_cte_table_name_, tblname) && tblname.length() && no_defined_database_name) { //cte表引用了自身,此时的cte是递归 TableItem *item = NULL; - if (!is_oracle_mode() && !params_.has_recursive_word_) { - ret = OB_TABLE_NOT_EXIST; - LOG_WARN("cte table shows in union stmt without recursive keyword", K(ret)); - } else if (OB_FAIL(resolve_recursive_cte_table(parse_tree, item))) { + if (OB_FAIL(resolve_recursive_cte_table(parse_tree, item))) { LOG_WARN("revolve recursive set query's right child failed", K(ret)); } else if (cte_ctx_.more_than_two_branch()) { ret = OB_ERR_NEED_ONLY_TWO_BRANCH_IN_RECURSIVE_CTE; @@ -14321,14 +14370,14 @@ int ObDMLResolver::resolve_basic_table_with_cte(const ParseNode &parse_tree, Tab //CTE_TABLE仅仅标记在with clause中,union all右边儿子的中被解析出来的cte伪表 table_item->type_ = TableItem::CTE_TABLE; } - } else if (OB_FAIL(check_CTE_name_exist(tblname, find_CTE_name, table_item))) { + } else if (OB_FAIL(check_parent_CTE_name_exist(tblname, find_CTE_name, table_item))) { LOG_WARN("check CTE duplicate name failed", K(ret)); } else if (find_CTE_name && no_defined_database_name) { TableItem* CTE_table_item = table_item; table_item = NULL; if (OB_FAIL(resolve_cte_table(parse_tree, CTE_table_item, table_item))) { LOG_WARN("failed to resolve CTE table", K(ret)); - }else if (OB_ISNULL(table_item)) { + } else if (OB_ISNULL(table_item)) { table_item = CTE_table_item; ret = OB_ERR_UNEXPECTED; LOG_WARN("failed to resolve CTE table", K(ret)); @@ -14547,7 +14596,12 @@ int ObDMLResolver::resolve_with_clause_opt_alias_colnames(const ParseNode *parse LOG_WARN("failed to set_refactored", K(ret)); //change error number if (OB_HASH_EXIST == ret) { - ret = OB_ERR_CTE_COLUMN_ALIAS_DUPLICATE; + if (lib::is_oracle_mode()) { + ret = OB_ERR_CTE_COLUMN_ALIAS_DUPLICATE; + } else { + ret = OB_ERR_COLUMN_DUPLICATE; + LOG_USER_ERROR(OB_ERR_COLUMN_DUPLICATE, src.length(), src.ptr()); + } LOG_WARN("column ambiguously defined", K(ret)); } } @@ -14738,7 +14792,7 @@ int ObDMLResolver::resolve_with_clause(const ParseNode *node, bool same_level) } else { ObString table_name(child_node->children_[0]->str_len_, child_node->children_[0]->str_value_); - if (OB_FAIL(ObDMLResolver::check_CTE_name_exist(table_name, duplicate_name))) { + if (OB_FAIL(ObDMLResolver::check_current_CTE_name_exist(table_name, duplicate_name))) { LOG_WARN("check cte name failed", K(ret)); } else if (duplicate_name) { if (is_oracle_mode()) { @@ -14770,14 +14824,6 @@ int ObDMLResolver::resolve_with_clause(const ParseNode *node, bool same_level) } } } - - //解析完本层的在加入parent的到本层,为了的是本层优先, - //屏蔽父层次相同名字的cte的表 - if (OB_SUCC(ret) && is_select_resolver()) { - if (OB_FAIL(set_parent_cte())) { - LOG_WARN("set parent cte failed"); - } - } return ret; } diff --git a/src/sql/resolver/dml/ob_dml_resolver.h b/src/sql/resolver/dml/ob_dml_resolver.h index d5c3d25469..4b7fcb078b 100644 --- a/src/sql/resolver/dml/ob_dml_resolver.h +++ b/src/sql/resolver/dml/ob_dml_resolver.h @@ -675,8 +675,10 @@ protected: int add_cte_table_to_children(ObChildStmtResolver& child_resolver); int add_parent_cte_table_to_children(ObChildStmtResolver& child_resolver); void set_non_record(bool record) { with_clause_without_record_ = record; }; - int check_CTE_name_exist(const ObString &var_name, bool &dup_name); - int check_CTE_name_exist(const ObString &var_name, bool &dup_name, TableItem *&table_item); + int check_current_CTE_name_exist(const ObString &var_name, bool &dup_name); + int check_current_CTE_name_exist(const ObString &var_name, bool &dup_name, TableItem *&table_item); + int check_parent_CTE_name_exist(const ObString &var_name, bool &dup_name); + int check_parent_CTE_name_exist(const ObString &var_name, bool &dup_name, TableItem *&table_item); int set_cte_ctx(ObCteResolverCtx &cte_ctx, bool copy_col_name = true, bool in_subquery = false); int add_cte_table_item(TableItem *table_item, bool &dup_name); int get_opt_alias_colnames_for_recursive_cte(ObIArray& columns, const ParseNode *parse_tree); diff --git a/src/sql/resolver/dml/ob_select_resolver.cpp b/src/sql/resolver/dml/ob_select_resolver.cpp index 610ff22a21..2f8dd9a79a 100644 --- a/src/sql/resolver/dml/ob_select_resolver.cpp +++ b/src/sql/resolver/dml/ob_select_resolver.cpp @@ -121,12 +121,18 @@ int ObSelectResolver::do_check_basic_table_in_cte_recursive_union(const ParseNod int ObSelectResolver::do_check_node_in_cte_recursive_union(const ParseNode* current_node, bool &recursive_union) { int ret = OB_SUCCESS; - while (OB_NOT_NULL(current_node) && current_node->type_ != T_RELATION_FACTOR && current_node->num_child_ == 1) { + while (OB_NOT_NULL(current_node) + && current_node->type_ != T_RELATION_FACTOR + && current_node->type_ != T_WITH_CLAUSE_LIST + && current_node->num_child_ == 1) { // the current node with only one child node expands immediately to prevent the recursive level from being too high current_node = current_node->children_[0]; } if (OB_ISNULL(current_node)) { + } else if (current_node->type_ == T_WITH_CLAUSE_LIST && is_oracle_mode()) { + ret = OB_ERR_UNSUPPORTED_USE_OF_CTE; + LOG_WARN("invalid argument, oracle cte do not support a with clause nest", K(ret)); } else if (current_node->type_ == T_RELATION_FACTOR) { // find relation factor, check it if (OB_FAIL(do_check_basic_table_in_cte_recursive_union(*current_node, recursive_union))) { @@ -158,6 +164,9 @@ int ObSelectResolver::check_query_is_recursive_union(const ParseNode &parse_tree || OB_ISNULL(parse_tree.children_[PARSE_SELECT_SET])) { ret = OB_ERR_UNEXPECTED; LOG_WARN("unexpected null", K(ret)); + } else if (NULL != parse_tree.children_[PARSE_SELECT_WITH] && is_oracle_mode()) { + ret = OB_ERR_UNSUPPORTED_USE_OF_CTE; + LOG_WARN("invalid argument, oracle cte do not support a with clause nest", K(ret)); } else if (OB_FAIL(do_check_node_in_cte_recursive_union(left_node, left_recursive_union))) { //test left branch LOG_WARN("failed to check set query in cte is recursive union", K(ret)); @@ -254,9 +263,15 @@ int ObSelectResolver::do_resolve_set_query_in_cte(const ParseNode &parse_tree, b } else { LOG_WARN("Failed to find anchor member", K(ret)); } + } else if (OB_ISNULL(left_select_stmt = left_resolver.get_child_stmt())) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected null stmt"); + } else if (lib::is_oracle_mode() && left_select_stmt->is_set_stmt()) { + ret = OB_ERR_NEED_ONLY_TWO_BRANCH_IN_RECURSIVE_CTE; + LOG_WARN("UNION ALL operation in recursive WITH clause must have only two branches", K(ret)); + } else if (OB_FAIL(ObRawExprUtils::wrap_enum_set_for_stmt(*params_.expr_factory_, left_select_stmt, session_info_))) { + LOG_WARN("failed to wrap_enum_set_for_stmt", KPC(left_select_stmt)); } else { - left_select_stmt = left_resolver.get_child_stmt(); - if (swap_branch) { select_stmt->set_children_swapped(); } @@ -296,14 +311,19 @@ int ObSelectResolver::do_resolve_set_query_in_cte(const ParseNode &parse_tree, b select_stmt->add_set_query(left_select_stmt); select_stmt->add_set_query(right_select_stmt); select_stmt->set_calc_found_rows(left_select_stmt->is_calc_found_rows()); + /**MySQL + * The types of the CTE result columns are inferred from the column types of the nonrecursive SELECT part only, + * and the columns are all nullable. For type determination, the recursive SELECT part is ignored. + */ if (OB_FAIL(ObOptimizerUtil::gen_set_target_list(allocator_, session_info_, params_.expr_factory_, *left_select_stmt, *right_select_stmt, select_stmt, - !is_oracle_mode()))) { + lib::is_mysql_mode() && right_resolver.cte_ctx_.is_recursive(), + &cte_ctx_.cte_col_names_))) { LOG_WARN("failed to gen set target list.", K(ret)); } else if (!right_resolver.cte_ctx_.is_recursive()) { /*do nothing*/ - } else if (OB_FAIL(check_cte_set_types(*left_select_stmt, *right_select_stmt))) { + } else if (lib::is_oracle_mode() && OB_FAIL(check_cte_set_types(*left_select_stmt, *right_select_stmt))) { LOG_WARN("check cte set types", K(ret)); } else if (select_stmt->is_set_distinct() || ObSelectStmt::UNION != select_stmt->get_set_op()) { // 必须是union all @@ -1275,6 +1295,14 @@ int ObSelectResolver::resolve(const ParseNode &parse_tree) } } } + if (OB_SUCC(ret) && !is_oracle_mode() && !params_.has_cte_param_list_) { + cte_ctx_.cte_col_names_.reuse(); + for (int64_t i = 0; OB_SUCC(ret) && i < select_stmt->get_select_item_size(); i++) { + if (OB_FAIL(cte_ctx_.cte_col_names_.push_back(select_stmt->get_select_item(i).alias_name_))) { + LOG_WARN("push back column alias name failed", K(ret)); + } + } + } return ret; } @@ -2159,12 +2187,6 @@ int ObSelectResolver::resolve_field_list(const ParseNode &node) } else if (OB_FAIL(recursive_check_grouping_columns(select_stmt, select_item.expr_))) { LOG_WARN("failed to recursive check grouping columns", K(ret)); } else {/*do nothing*/} - // add for cte: - if (OB_SUCC(ret) && !is_oracle_mode() && !params_.has_cte_param_list_) { - if (OB_FAIL(cte_ctx_.cte_col_names_.push_back(select_item.alias_name_))) { - LOG_WARN("push back column alias name failed", K(ret)); - } - } } // end for if (OB_SUCC(ret) && has_nested_aggr_) { @@ -2474,13 +2496,6 @@ int ObSelectResolver::resolve_star_for_table_groups() } } } - if (OB_SUCC(ret) && !is_oracle_mode() && !params_.has_cte_param_list_) { - for (int64_t i = 0; OB_SUCC(ret) && i < target_list.count(); ++i) { - if (OB_FAIL(cte_ctx_.cte_col_names_.push_back(target_list[i].alias_name_))) { - LOG_WARN("push back column alias name failed", K(ret)); - } - } - } } return ret; @@ -2656,11 +2671,6 @@ int ObSelectResolver::resolve_star(const ParseNode *node) } } } - if (OB_SUCC(ret) && !is_oracle_mode() && !params_.has_cte_param_list_) { - if (OB_FAIL(cte_ctx_.cte_col_names_.push_back(select_item.alias_name_))) { - LOG_WARN("push back column alias name failed", K(ret)); - } - } } else if (OB_FAIL(resolve_star_for_table_groups())) { LOG_WARN("resolve star for table groups failed", K(ret)); } @@ -2735,11 +2745,6 @@ int ObSelectResolver::resolve_star(const ParseNode *node) ret = column_namespace_checker_.check_column_existence_in_using_clause( table_items.at(i)->table_id_, target_list.at(j).expr_name_); } - if (OB_SUCC(ret) && !is_oracle_mode() && !params_.has_cte_param_list_) { - if (OB_FAIL(cte_ctx_.cte_col_names_.push_back(target_list[j].alias_name_))) { - LOG_WARN("push back column alias name failed", K(ret)); - } - } } } } @@ -3505,7 +3510,7 @@ int ObSelectResolver::resolve_cte_pseudo_column(const ParseNode *search_node, int ObSelectResolver::add_parent_cte_table_item(TableItem *table_item) { int ret = OB_SUCCESS; - if (OB_FAIL(parent_cte_tables_.push_back(table_item))) { + if (OB_FAIL(add_var_to_array_no_dup(parent_cte_tables_, table_item))) { LOG_WARN("add parent cte table failed", K(ret)); } return ret; @@ -6138,7 +6143,12 @@ int ObSelectResolver::check_recursive_cte_usage(const ObSelectStmt &select_stmt) } } if (cte_ctx_.invalid_recursive_union() && fake_cte_table_count >= 1) { - ret = OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE; + if (lib::is_mysql_mode()) { + ret = OB_NOT_SUPPORTED; + LOG_USER_ERROR(OB_NOT_SUPPORTED, "recursive UNION DISTINCT in Recursive Common Table Expression"); + } else { + ret = OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE; + } LOG_WARN("recursive WITH clause must use a UNION ALL operation", K(ret)); } else if (fake_cte_table_count > 1) { ret = OB_ERR_CTE_RECURSIVE_QUERY_NAME_REFERENCED_MORE_THAN_ONCE; diff --git a/src/sql/resolver/expr/ob_raw_expr_util.cpp b/src/sql/resolver/expr/ob_raw_expr_util.cpp index 85aec20753..30ae3c9f29 100644 --- a/src/sql/resolver/expr/ob_raw_expr_util.cpp +++ b/src/sql/resolver/expr/ob_raw_expr_util.cpp @@ -4215,6 +4215,43 @@ int ObRawExprUtils::create_type_to_str_expr(ObRawExprFactory &expr_factory, return ret; } +int ObRawExprUtils::wrap_enum_set_for_stmt(ObRawExprFactory &expr_factory, + ObSelectStmt *stmt, + ObSQLSessionInfo *session_info) +{ + int ret = OB_SUCCESS; + if (OB_ISNULL(stmt)) { + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected null stmt", K(ret)); + } else if (stmt->is_set_stmt()) { + for (int64_t i = 0; OB_SUCC(ret) && i < stmt->get_set_query().count(); i ++) { + ret = wrap_enum_set_for_stmt(expr_factory, + stmt->get_set_query().at(i), + session_info); + } + } else { + for (int64_t i = 0; OB_SUCC(ret) && i < stmt->get_select_item_size(); i ++) { + ObRawExpr *&expr = stmt->get_select_item(i).expr_; + if (OB_ISNULL(expr)){ + ret = OB_ERR_UNEXPECTED; + LOG_WARN("unexpected null expr"); + } else if (ob_is_enumset_tc(expr->get_result_type().get_type())) { + ObSysFunRawExpr *cast_expr = NULL; + if (OB_FAIL(ObRawExprUtils::create_type_to_str_expr(expr_factory, + expr, + cast_expr, + session_info, + true))) { + LOG_WARN("create to str expr for stmt failed", K(ret)); + } else { + expr = cast_expr; + } + } + } + } + return ret; +} + int ObRawExprUtils::get_exec_param_expr(ObRawExprFactory &expr_factory, ObQueryRefRawExpr *query_ref, ObRawExpr *outer_val_expr, diff --git a/src/sql/resolver/expr/ob_raw_expr_util.h b/src/sql/resolver/expr/ob_raw_expr_util.h index 9cf42c0ace..a304312229 100644 --- a/src/sql/resolver/expr/ob_raw_expr_util.h +++ b/src/sql/resolver/expr/ob_raw_expr_util.h @@ -508,6 +508,10 @@ public: bool is_type_to_str, ObObjType dst_type = ObMaxType); + static int wrap_enum_set_for_stmt(ObRawExprFactory &expr_factory, + ObSelectStmt *stmt, + ObSQLSessionInfo *session_info); + static int get_exec_param_expr(ObRawExprFactory &expr_factory, ObQueryRefRawExpr *query_ref, ObRawExpr *correlated_expr, diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/basic_mysql.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/basic_mysql.result index e80a0282e8..f7658ea05f 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/basic_mysql.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/basic_mysql.result @@ -122,7 +122,7 @@ WITH t4 as (select 1 from dual) select * from t4; ############################## ## PART 2.1 定义列名重复 with cte(a,a) as (select 1,1 from dual) select * from cte; -ERROR HY000: duplicate name found in column alias list for WITH clause +ERROR 42S21: Duplicate column name 'a' ## PART 2.2.1 定义列数量与查询产生列一致或不一致 explain basic with cte(a,b) as (select 1,1 from dual) select * from cte; diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_errno_mysql.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_errno_mysql.result index 96da8d6d28..60a386fefe 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_errno_mysql.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_errno_mysql.result @@ -6,13 +6,13 @@ with cte(a,b) as (select 1 from dual) select * from cte; ERROR HY000: View's SELECT and view's field list have different column counts with cte(a,b) as (with cte2(a,b) as (select 1,1 from dual) select a,b from cte) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with cte(a,a) as (select 1 from dual) select * from cte; -ERROR HY000: duplicate name found in column alias list for WITH clause +ERROR 42S21: Duplicate column name 'a' with cte as (select 1,1 from dual union all select a+1,b+1 from cte where cte.a < 10) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist # MySQL不支持search depth关键字 with cte(a,b,c) as @@ -33,7 +33,7 @@ select 1,2,3 from dual union select a+1,b+1,c+1 from cte, cte b where cte.c < 10 and b.c = cte.c ) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with cte(a,b,c) as ( @@ -43,10 +43,10 @@ select 1,2,3 from dual union all select a+1,b+1,c+1 from cte, cte b where cte.c < 10 and b.c = cte.c ) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with t1 as (select c1 from t1) select * from t1; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.t1' doesn't exist ## success with cte1(a,b) as (select 'a','b' from dual), cte2 as (select * from cte1 where b > 'c'), cte3 as (select * from cte2 where a > 1 union select * from cte2 where a > 1) select * from cte3; @@ -56,26 +56,26 @@ with cte1(a,b) as (select 'a','b' from dual), cte2 as (select * from cte1 where +---+---+ with cte(a) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 UNION ALL select 2 from dual) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with cte(n) AS ( select 1 from dual UNION ALL select (select 1 from dual) from cte where cte.n < 2) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist create table t1(c1 int, c2 int, c3 int); with cte (c1, c2, c3) as ( select * from ( select c1, c2, c3 from t1 union select c1, c2, c3 from t1) where c1 = 1 union all select * from t1 join cte c on t1.c1 = c.c1 where c.c1 < 10 ) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with cte(n) AS ( select 1 from cte) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 order by n ) select * from cte; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.cte' doesn't exist with RECURSIVE cte(n) as (select 1 union all select (select n+1 from cte where n < 1) ) select n from cte; ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_mysql_official.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_mysql_official.result index d066020ea4..4a4419334e 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_mysql_official.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_mysql_official.result @@ -215,16 +215,16 @@ CREATE TABLE numbers ) SELECT * FROM my_cte; SELECT * FROM numbers; -+---+ -| n | -+---+ -| 1 | -| 2 | -| 3 | -| 4 | -| 5 | -| 6 | -+---+ ++------+ +| n | ++------+ +| 1 | +| 2 | +| 3 | +| 4 | +| 5 | +| 6 | ++------+ INSERT INTO numbers WITH RECURSIVE my_cte(n) AS @@ -236,22 +236,22 @@ WITH RECURSIVE my_cte(n) AS SELECT * FROM my_cte; SELECT * FROM numbers; -+---+ -| n | -+---+ -| 1 | -| 2 | -| 3 | -| 4 | -| 5 | -| 6 | -| 1 | -| 2 | -| 3 | -| 4 | -| 5 | -| 6 | -+---+ ++------+ +| n | ++------+ +| 1 | +| 2 | +| 3 | +| 4 | +| 5 | +| 6 | +| 1 | +| 2 | +| 3 | +| 4 | +| 5 | +| 6 | ++------+ DELETE FROM numbers WHERE numbers.n > @@ -265,12 +265,12 @@ WHERE numbers.n > SELECT AVG(n)/2 FROM my_cte ); SELECT * FROM numbers; -+---+ -| n | -+---+ -| 1 | -| 1 | -+---+ ++------+ +| n | ++------+ +| 1 | +| 1 | ++------+ ################################################################################################ ### PART 2 generating series diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_2_mysql.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_2_mysql.result index a4aa5cfaec..61c1272896 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_2_mysql.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_2_mysql.result @@ -1028,11 +1028,11 @@ SELECT * FROM x; with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT count(*) FROM x) SELECT * FROM x; -ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block +ERROR HY000: ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT sum(n) FROM x) SELECT * FROM x; -ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block +ERROR HY000: ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT n+1 FROM x where n < 10 ORDER BY 1 ) SELECT * FROM x; +------+ @@ -1105,7 +1105,7 @@ with RECURSIVE outermost(x) AS ( UNION SELECT * FROM innermost) ) SELECT * FROM outermost ORDER BY 1; -ERROR HY000: UNION ALL operation in recursive WITH clause must have only two branches +ERROR HY000: More than one recursive query blocks of Common Table Expression not supported with RECURSIVE outermost(x) AS ( SELECT 1 FROM DUAL diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_mysql.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_mysql.result index 8c687e0a26..b570e91e97 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_mysql.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/cte_without_explain_mysql.result @@ -102,7 +102,7 @@ ERROR 42S02: Table 'cte_st.qn' doesn't exist # recursive with recursive qn AS (SELECT a FROM qn) SELECT qn.a FROM qn; -ERROR HY000: recursive WITH clause must use a UNION ALL operation +ERROR HY000: Recursive Common Table Expression should contain a UNION ALL with RECURSIVE qn1 AS (SELECT a FROM qn3), qn2 AS (SELECT a FROM qn1), @@ -520,7 +520,7 @@ with RECURSIVE qn (foo, bar) as (select 1,1 from t1) select * from qn; | 1 | 1 | +-----+-----+ with RECURSIVE qn (foo, foo) as (select 1,2 from dual) select * from qn; -ERROR HY000: duplicate name found in column alias list for WITH clause +ERROR 42S21: Duplicate column name 'foo' # Derived tables support this too # Column names for QN/DT are printed @@ -1650,7 +1650,7 @@ with RECURSIVE t4(a) as (select 1 from dual union all select a+1 from t4 where a | 9 | +------+ with RECURSIVE cte(a,a) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; -ERROR HY000: duplicate name found in column alias list for WITH clause +ERROR 42S21: Duplicate column name 'a' with RECURSIVE cte(a,b) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; +------+------+ | a | b | @@ -1747,122 +1747,23 @@ with RECURSIVE cte(a) as (select 1 from dual union all select 2 from dual), cte_ | 2 | +------+ with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 UNION ALL select 2 from dual) select * from cte; -ERROR HY000: UNION ALL operation in recursive WITH clause must have only two branches +ERROR HY000: More than one recursive query blocks of Common Table Expression not supported with RECURSIVE cte(n) AS ( select 1 from cte) select * from cte; -ERROR HY000: recursive WITH clause must use a UNION ALL operation +ERROR HY000: Recursive Common Table Expression should contain a UNION ALL set @@ob_query_timeout=1000000; with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte; -ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block +ERROR HY000: ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported set @@ob_query_timeout=10000000; with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 union all select n+1 from cte where n < 2) select * from cte; -ERROR HY000: UNION ALL operation in recursive WITH clause must have only two branches +ERROR HY000: More than one recursive query blocks of Common Table Expression not supported with RECURSIVE cte(n) as (select 1 from dual union all select c1 from t1 union all (with RECURSIVE cte(n) as (select c1 from t1) select * from cte)) select * from cte; -ERROR HY000: cycle detected while executing recursive WITH query -with RECURSIVE cte(n) as (select '1' from dual union all select n+1 from cte where n < 100) select * from cte; +------+ | n | +------+ -| 1 | -| 2 | -| 3 | -| 4 | -| 5 | -| 6 | -| 7 | -| 8 | -| 9 | -| 10 | -| 11 | -| 12 | -| 13 | -| 14 | -| 15 | -| 16 | -| 17 | -| 18 | -| 19 | -| 20 | -| 21 | -| 22 | -| 23 | -| 24 | -| 25 | -| 26 | -| 27 | -| 28 | -| 29 | -| 30 | -| 31 | -| 32 | -| 33 | -| 34 | -| 35 | -| 36 | -| 37 | -| 38 | -| 39 | -| 40 | -| 41 | -| 42 | -| 43 | -| 44 | -| 45 | -| 46 | -| 47 | -| 48 | -| 49 | -| 50 | -| 51 | -| 52 | -| 53 | -| 54 | -| 55 | -| 56 | -| 57 | -| 58 | -| 59 | -| 60 | -| 61 | -| 62 | -| 63 | -| 64 | -| 65 | -| 66 | -| 67 | -| 68 | -| 69 | -| 70 | -| 71 | -| 72 | -| 73 | -| 74 | -| 75 | -| 76 | -| 77 | -| 78 | -| 79 | -| 80 | -| 81 | -| 82 | -| 83 | -| 84 | -| 85 | -| 86 | -| 87 | -| 88 | -| 89 | -| 90 | -| 91 | -| 92 | -| 93 | -| 94 | -| 95 | -| 96 | -| 97 | -| 98 | -| 99 | -| 100 | +| 1 | +------+ +with RECURSIVE cte(n) as (select '1' from dual union all select n+1 from cte where n < 100) select * from cte; +ERROR 22001: Data too long for column with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte; ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/dis_recursive_mysql.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/dis_recursive_mysql.result index a04270cc22..f519149dcf 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/dis_recursive_mysql.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/dis_recursive_mysql.result @@ -160,13 +160,14 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 conds([r.empno = e.MGR]), nl_params_(nil), use_batch=false 4 - output([r.empno]), filter(nil), rowset=256 access([r.empno]) is_index_back=false, is_global_index=false, range_key(nil), range(MIN ; MAX) - 5 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 5 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 6 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, @@ -243,11 +244,12 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) merge_directions([ASC]) - 4 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 - 5 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 + 5 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 sort_keys([e.MGR, ASC]) 6 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -328,7 +330,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -421,10 +424,11 @@ Outputs & filters: access([d.SAL]), partitions(p0) is_index_back=false, is_global_index=false, range_key([d.__pk_increment]), range(MIN ; MAX)always true - 6 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 6 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) - 7 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 - 8 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 7 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 + 8 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 equal_conds([e.SAL = d.SAL]), other_conds(nil) 9 - output([d.SAL]), filter(nil), rowset=256 access([d.SAL]), partitions(p0) @@ -552,7 +556,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([e.MGR = r.empno]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -632,7 +637,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -735,9 +741,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.MGR = cast(n.empno, DECIMAL(-1, -1))]), other_conds(nil) - 9 - output([r.empno], [e.MGR], [r.iters], [r.sal], [e.SAL]), filter(nil), rowset=256 + 9 - output([e.MGR], [r.empno], [r.iters], [r.sal], [e.SAL]), filter(nil), rowset=256 equal_conds([r.mgr = e.EMPno]), other_conds(nil) 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -840,9 +847,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.MGR = cast(n.empno, DECIMAL(-1, -1))]), other_conds(nil) - 9 - output([r.empno], [e.MGR], [e.SAL], [r.iters], [r.sal]), filter(nil), rowset=256 + 9 - output([e.MGR], [e.SAL], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 10 - output([e.EMPno], [e.MGR], [e.SAL]), filter([e.EMPno < e.MGR]), rowset=256 access([e.EMPno], [e.MGR], [e.SAL]), partitions(p0) @@ -946,7 +954,8 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 9 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 10 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 @@ -1053,7 +1062,8 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 9 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 10 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 @@ -1137,7 +1147,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([r.empno]), filter(nil), rowset=256 access([r.empno]) @@ -1217,7 +1228,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([e.MGR = r.empno]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -1320,9 +1332,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([cast(n.empno, DECIMAL(-1, -1)) = e.MGR], [r.mgr = e.EMPno]), other_conds(nil) - 9 - output([r.empno], [r.mgr], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 + 9 - output([r.mgr], [r.empno], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 conds(nil), nl_params_(nil), use_batch=false 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -1427,9 +1440,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([r.mgr = e.EMPno], [cast(n.empno, DECIMAL(-1, -1)) = e.MGR]), other_conds(nil) - 9 - output([r.empno], [r.mgr], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 + 9 - output([r.mgr], [r.empno], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 conds(nil), nl_params_(nil), use_batch=false 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -1510,7 +1524,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -1589,7 +1604,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.EMPno], [e.ENAME]), filter([e.EMPno < e.MGR]), rowset=256 access([e.MGR], [e.EMPno], [e.ENAME]), partitions(p0) @@ -1697,13 +1713,14 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 conds([r.empno = e.MGR]), nl_params_(nil), use_batch=false 4 - output([r.empno]), filter(nil), rowset=256 access([r.empno]) is_index_back=false, is_global_index=false, range_key(nil), range(MIN ; MAX) - 5 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 5 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 6 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, @@ -1780,11 +1797,12 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) merge_directions([ASC]) - 4 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 - 5 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 + 5 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 sort_keys([e.MGR, ASC]) 6 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -1865,7 +1883,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -1958,10 +1977,11 @@ Outputs & filters: access([d.SAL]), partitions(p0) is_index_back=false, is_global_index=false, range_key([d.__pk_increment]), range(MIN ; MAX)always true - 6 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 6 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) - 7 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 - 8 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 7 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 + 8 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 equal_conds([e.SAL = d.SAL]), other_conds(nil) 9 - output([d.SAL]), filter(nil), rowset=256 access([d.SAL]), partitions(p0) @@ -2089,7 +2109,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([e.MGR = r.empno]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -2169,7 +2190,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -2272,9 +2294,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.MGR = cast(n.empno, DECIMAL(-1, -1))]), other_conds(nil) - 9 - output([r.empno], [e.MGR], [r.iters], [r.sal], [e.SAL]), filter(nil), rowset=256 + 9 - output([e.MGR], [r.empno], [r.iters], [r.sal], [e.SAL]), filter(nil), rowset=256 equal_conds([r.mgr = e.EMPno]), other_conds(nil) 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -2377,9 +2400,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.MGR = cast(n.empno, DECIMAL(-1, -1))]), other_conds(nil) - 9 - output([r.empno], [e.MGR], [e.SAL], [r.iters], [r.sal]), filter(nil), rowset=256 + 9 - output([e.MGR], [e.SAL], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 10 - output([e.EMPno], [e.MGR], [e.SAL]), filter([e.EMPno < e.MGR]), rowset=256 access([e.EMPno], [e.MGR], [e.SAL]), partitions(p0) @@ -2483,7 +2507,8 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 9 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 10 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 @@ -2590,7 +2615,8 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 9 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 10 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 @@ -2675,7 +2701,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([r.empno]), filter(nil), rowset=256 access([r.empno]) @@ -2755,7 +2782,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([e.MGR = r.empno]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -2858,9 +2886,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([cast(n.empno, DECIMAL(-1, -1)) = e.MGR], [r.mgr = e.EMPno]), other_conds(nil) - 9 - output([r.empno], [r.mgr], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 + 9 - output([r.mgr], [r.empno], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 conds(nil), nl_params_(nil), use_batch=false 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -2965,9 +2994,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([r.mgr = e.EMPno], [cast(n.empno, DECIMAL(-1, -1)) = e.MGR]), other_conds(nil) - 9 - output([r.empno], [r.mgr], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 + 9 - output([r.mgr], [r.empno], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 conds(nil), nl_params_(nil), use_batch=false 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -3048,7 +3078,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -3127,7 +3158,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.EMPno], [e.ENAME]), filter([e.EMPno < e.MGR]), rowset=256 access([e.MGR], [e.EMPno], [e.ENAME]), partitions(p0) @@ -3235,13 +3267,14 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 conds([r.empno = e.MGR]), nl_params_(nil), use_batch=false 4 - output([r.empno]), filter(nil), rowset=256 access([r.empno]) is_index_back=false, is_global_index=false, range_key(nil), range(MIN ; MAX) - 5 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 5 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 6 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, @@ -3318,11 +3351,12 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) merge_directions([ASC]) - 4 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 - 5 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 + 5 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 sort_keys([e.MGR, ASC]) 6 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -3403,7 +3437,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -3496,10 +3531,11 @@ Outputs & filters: access([d.SAL]), partitions(p0) is_index_back=false, is_global_index=false, range_key([d.__pk_increment]), range(MIN ; MAX)always true - 6 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 6 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) - 7 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 - 8 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 7 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 + 8 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 equal_conds([e.SAL = d.SAL]), other_conds(nil) 9 - output([d.SAL]), filter(nil), rowset=256 access([d.SAL]), partitions(p0) @@ -3627,7 +3663,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([e.MGR = r.empno]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -3707,7 +3744,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -3810,9 +3848,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.MGR = cast(n.empno, DECIMAL(-1, -1))]), other_conds(nil) - 9 - output([r.empno], [e.MGR], [r.iters], [r.sal], [e.SAL]), filter(nil), rowset=256 + 9 - output([e.MGR], [r.empno], [r.iters], [r.sal], [e.SAL]), filter(nil), rowset=256 equal_conds([r.mgr = e.EMPno]), other_conds(nil) 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -3915,9 +3954,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.MGR = cast(n.empno, DECIMAL(-1, -1))]), other_conds(nil) - 9 - output([r.empno], [e.MGR], [e.SAL], [r.iters], [r.sal]), filter(nil), rowset=256 + 9 - output([e.MGR], [e.SAL], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 10 - output([e.EMPno], [e.MGR], [e.SAL]), filter([e.EMPno < e.MGR]), rowset=256 access([e.EMPno], [e.MGR], [e.SAL]), partitions(p0) @@ -4021,7 +4061,8 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 9 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 10 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 @@ -4128,7 +4169,8 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) 9 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 10 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 @@ -4212,7 +4254,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([r.empno]), filter(nil), rowset=256 access([r.empno]) @@ -4292,7 +4335,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([e.MGR = r.empno]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -4395,9 +4439,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([cast(n.empno, DECIMAL(-1, -1)) = e.MGR], [r.mgr = e.EMPno]), other_conds(nil) - 9 - output([r.empno], [r.mgr], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 + 9 - output([r.mgr], [r.empno], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 conds(nil), nl_params_(nil), use_batch=false 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -4502,9 +4547,10 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 equal_conds([r.mgr = e.EMPno], [cast(n.empno, DECIMAL(-1, -1)) = e.MGR]), other_conds(nil) - 9 - output([r.empno], [r.mgr], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 + 9 - output([r.mgr], [r.empno], [r.iters], [r.sal], [n.empno]), filter(nil), rowset=256 conds(nil), nl_params_(nil), use_batch=false 10 - output([r.mgr], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 access([r.mgr], [r.empno], [r.iters], [r.sal]) @@ -4585,7 +4631,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.ENAME], [e.EMPno]), filter(nil), rowset=256 access([e.MGR], [e.ENAME], [e.EMPno]), partitions(p0) @@ -4664,7 +4711,8 @@ Outputs & filters: access([e.JOB], [e.ENAME], [e.MGR], [e.EMPno]), partitions(p0) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key([e.__pk_increment]), range(MIN ; MAX)always true - 3 - output([e.ENAME], [e.MGR], [e.EMPno]), filter(nil), rowset=256 + 3 - output([column_conv(VARCHAR,utf8mb4_general_ci,length:30,NULL,e.ENAME)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(DECIMAL,PS:(10,0), + NULL,e.EMPno)]), filter(nil), rowset=256 equal_conds([r.empno = e.MGR]), other_conds(nil) 4 - output([e.MGR], [e.EMPno], [e.ENAME]), filter([e.EMPno < e.MGR]), rowset=256 access([e.MGR], [e.EMPno], [e.ENAME]), partitions(p0) @@ -4799,12 +4847,13 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 conds([e.EMPno > VIEW1.c1]), nl_params_(nil), use_batch=false - 9 - output([r.empno], [e.MGR], [e.EMPno], [e.SAL], [r.iters], [r.sal]), filter(nil), rowset=256 + 9 - output([e.EMPno], [e.MGR], [e.SAL], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) - 10 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 - 11 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 + 10 - output([e.EMPno], [e.MGR], [e.SAL]), filter(nil), rowset=256 + 11 - output([e.EMPno], [e.MGR], [e.SAL]), filter(nil), rowset=256 equal_conds([cast(n.empno, DECIMAL(-1, -1)) = e.MGR]), other_conds(nil) 12 - output([n.empno]), filter(nil), rowset=256 access([n.empno]), partitions(p0) @@ -4918,14 +4967,15 @@ Outputs & filters: access([n2.empno]), partitions(p0) is_index_back=false, is_global_index=false, range_key([n2.__pk_increment]), range(MIN ; MAX)always true - 8 - output([r.empno], [e.MGR], [r.iters + 1], [r.sal + e.SAL]), filter(nil), rowset=256 + 8 - output([column_conv(DECIMAL,PS:(10,0),NULL,r.empno)], [column_conv(DECIMAL,PS:(4,0),NULL,e.MGR)], [column_conv(BIGINT,PS:(1,0),NULL,r.iters + 1)], + [column_conv(DECIMAL,PS:(7,2),NULL,r.sal + e.SAL)]), filter(nil), rowset=256 conds([e.EMPno > VIEW1.c1]), nl_params_(nil), use_batch=false - 9 - output([r.empno], [e.MGR], [e.EMPno], [e.SAL], [r.iters], [r.sal]), filter(nil), rowset=256 + 9 - output([e.EMPno], [e.MGR], [e.SAL], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 conds(nil), nl_params_(nil), use_batch=false - 10 - output([r.empno], [e.MGR], [e.EMPno], [e.SAL], [r.iters], [r.sal]), filter(nil), rowset=256 + 10 - output([e.EMPno], [e.MGR], [e.SAL], [r.empno], [r.iters], [r.sal]), filter(nil), rowset=256 equal_conds([e.EMPno = r.mgr]), other_conds(nil) - 11 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 - 12 - output([e.MGR], [e.EMPno], [e.SAL]), filter(nil), rowset=256 + 11 - output([e.EMPno], [e.MGR], [e.SAL]), filter(nil), rowset=256 + 12 - output([e.EMPno], [e.MGR], [e.SAL]), filter(nil), rowset=256 equal_conds([cast(n.empno, DECIMAL(-1, -1)) = e.MGR]), other_conds(nil) 13 - output([n.empno]), filter(nil), rowset=256 access([n.empno]), partitions(p0) diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_mysql.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_mysql.result index 48f9d172f4..71daa2ebe4 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_mysql.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_mysql.result @@ -139,7 +139,7 @@ with RECURSIVE t4(a) as (select 1 from dual union all select a+1 from t4 where a ############################## ## PART 2.1 定义列名重复 with RECURSIVE cte(a,a) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; -ERROR HY000: duplicate name found in column alias list for WITH clause +ERROR 42S21: Duplicate column name 'a' ## PART 2.2.1 定义列数量与查询产生列一致或不一致 with RECURSIVE cte(a,b) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; @@ -973,24 +973,42 @@ with RECURSIVE cte(a) as (select 1 from dual union all select 2 from dual), cte_ ## 非常的复杂 ## 递归cte只能有两个入口 with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 UNION ALL select 2 from dual) select * from cte; -ERROR HY000: UNION ALL operation in recursive WITH clause must have only two branches +ERROR HY000: More than one recursive query blocks of Common Table Expression not supported ## 递归必须包含union all with RECURSIVE cte(n) AS ( select 1 from cte) select * from cte; -ERROR HY000: recursive WITH clause must use a UNION ALL operation +ERROR HY000: Recursive Common Table Expression should contain a UNION ALL set @@ob_query_timeout=1000000; with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte; -ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block +ERROR HY000: ORDER BY / LIMIT / SELECT DISTINCT / HAVING / WINDOW FUNCTION / GROUP BY in recursive query block of Common Table Expression not supported set @@ob_query_timeout=10000000; ##递归查询只允许有两个入口 with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 union all select n+1 from cte where n < 2) select * from cte; -ERROR HY000: UNION ALL operation in recursive WITH clause must have only two branches +ERROR HY000: More than one recursive query blocks of Common Table Expression not supported with RECURSIVE cte(n) as (select 1 from dual union all select c1 from t1 union all (with RECURSIVE cte(n) as (select c1 from t1) select * from cte)) select * from cte; -ERROR HY000: cycle detected while executing recursive WITH query ++------+ +| n | ++------+ +| 1 | +| 1 | +| 4 | +| 7 | +| 10 | +| 13 | +| 16 | +| 19 | +| 1 | +| 4 | +| 7 | +| 10 | +| 13 | +| 16 | +| 19 | ++------+ with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte; ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery @@ -1826,15 +1844,18 @@ Outputs & filters: 4 - output([UNION([1])], [UNION([2])], [UNION([3])]), filter(nil), rowset=256 5 - output([1], [1], [1]), filter(nil) values({1, 1, 1}) - 6 - output([cte1.a + 1], [cte1.b + 1], [cte1.c + 1]), filter([cte1.a < 10]), rowset=256 + 6 - output([column_conv(BIGINT,PS:(1,0),NULL,cte1.a + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte1.b + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte1.c + + 1)]), filter([cte1.a < 10]), rowset=256 access([cte1.a], [cte1.b], [cte1.c]) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key(nil), range(MIN ; MAX) - 7 - output([cte2.a + 1], [cte2.b + 1], [cte2.c + 1]), filter([cte2.a < 10]), rowset=256 + 7 - output([column_conv(BIGINT,PS:(1,0),NULL,cte2.a + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte2.b + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte2.c + + 1)]), filter([cte2.a < 10]), rowset=256 access([cte2.a], [cte2.b], [cte2.c]) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key(nil), range(MIN ; MAX) - 8 - output([cte3.a + 1], [cte3.b + 1], [cte3.c + 1]), filter(nil), rowset=256 + 8 - output([column_conv(BIGINT,PS:(1,0),NULL,cte3.a + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte3.b + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte3.c + + 1)]), filter(nil), rowset=256 conds([cte3.a < cte2.b]), nl_params_(nil), use_batch=false 9 - output([cte3.a], [cte3.b], [cte3.c]), filter([cte3.a < 10]), rowset=256 access([cte3.a], [cte3.b], [cte3.c]) @@ -1847,11 +1868,13 @@ Outputs & filters: 13 - output([UNION([1])], [UNION([2])], [UNION([3])]), filter(nil), rowset=256 14 - output([1], [1], [1]), filter(nil) values({1, 1, 1}) - 15 - output([cte1.a + 1], [cte1.b + 1], [cte1.c + 1]), filter([cte1.a < 10]), rowset=256 + 15 - output([column_conv(BIGINT,PS:(1,0),NULL,cte1.a + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte1.b + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte1.c + + 1)]), filter([cte1.a < 10]), rowset=256 access([cte1.a], [cte1.b], [cte1.c]) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key(nil), range(MIN ; MAX) - 16 - output([cte2.a + 1], [cte2.b + 1], [cte2.c + 1]), filter([cte2.a < 10]), rowset=256 + 16 - output([column_conv(BIGINT,PS:(1,0),NULL,cte2.a + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte2.b + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte2.c + + 1)]), filter([cte2.a < 10]), rowset=256 access([cte2.a], [cte2.b], [cte2.c]) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key(nil), range(MIN ; MAX) @@ -1861,7 +1884,8 @@ Outputs & filters: 19 - output([UNION([1])], [UNION([2])], [UNION([3])]), filter(nil), rowset=256 20 - output([1], [1], [1]), filter(nil) values({1, 1, 1}) - 21 - output([cte1.a + 1], [cte1.b + 1], [cte1.c + 1]), filter([cte1.a < 10]), rowset=256 + 21 - output([column_conv(BIGINT,PS:(1,0),NULL,cte1.a + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte1.b + 1)], [column_conv(BIGINT,PS:(1,0),NULL,cte1.c + + 1)]), filter([cte1.a < 10]), rowset=256 access([cte1.a], [cte1.b], [cte1.c]) is_index_back=false, is_global_index=false, filter_before_indexback[false], range_key(nil), range(MIN ; MAX) diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_optimize_mysql.result b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_optimize_mysql.result index 03ffdebbfe..588ea71aec 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_optimize_mysql.result +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/r/mysql/recursive_optimize_mysql.result @@ -52,7 +52,7 @@ WITH rw (ename, mgr, empno, job) AS SELECT ename, empno, mgr, job FROM rw WHERE job = 'PRESIDENT' ; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.rw' doesn't exist WITH rw (ename, mgr, empno, job) AS ( @@ -66,6 +66,6 @@ WITH rw (ename, mgr, empno, job) AS SELECT /*+ :HINT: */ ename, empno, mgr, job FROM rw WHERE job = 'PRESIDENT' ; -ERROR 42S02: Table doesn't exist +ERROR 42S02: Table 'cte_st.rw' doesn't exist drop database cte_st; diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/basic_mysql.test b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/basic_mysql.test index 1901a106e6..dba72dffdd 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/basic_mysql.test +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/basic_mysql.test @@ -110,7 +110,7 @@ WITH t4 as (select 1 from dual) select * from t4; --echo ############################## --echo ## PART 2.1 定义列名重复 ---error 5751 +--error 1060 with cte(a,a) as (select 1,1 from dual) select * from cte; --echo ## PART 2.2.1 定义列数量与查询产生列一致或不一致 diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_errno_mysql.test b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_errno_mysql.test index 87f03c1b25..cc69e53eff 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_errno_mysql.test +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_errno_mysql.test @@ -15,7 +15,7 @@ with cte(a,b) as (select 1 from dual) select * from cte; --error 1146 with cte(a,b) as (with cte2(a,b) as (select 1,1 from dual) select a,b from cte) select * from cte; ---error 5751 +--error 1060 with cte(a,a) as (select 1 from dual) select * from cte; --error 1146 diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_without_explain_mysql.test b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_without_explain_mysql.test index 7ccd4e5071..bf1ea5b0d5 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_without_explain_mysql.test +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/cte_without_explain_mysql.test @@ -256,7 +256,7 @@ with RECURSIVE qn (foo, bar) as (select 1,1 from dual) select * from qn; --error 1060 with RECURSIVE qn as (select 1,1 from t1) select * from qn; with RECURSIVE qn (foo, bar) as (select 1,1 from t1) select * from qn; ---error 5751 +--error 1060 with RECURSIVE qn (foo, foo) as (select 1,2 from dual) select * from qn; --echo # Derived tables support this too @@ -1029,7 +1029,7 @@ create table insert_t (c1 int, c2 int, c3 int); create table t4(id int, value char(10), parent_id int); with RECURSIVE t4(a) as (select 1 from dual union all select a+1 from t4 where a+1 < 10) select * from t4; ---error 5751 +--error 1060 with RECURSIVE cte(a,a) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; with RECURSIVE cte(a,b) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; --error 1353 @@ -1103,8 +1103,8 @@ with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte set @@ob_query_timeout=10000000; --error 5743 with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 union all select n+1 from cte where n < 2) select * from cte; ---error 5746 with RECURSIVE cte(n) as (select 1 from dual union all select c1 from t1 union all (with RECURSIVE cte(n) as (select c1 from t1) select * from cte)) select * from cte; +--error 1406 with RECURSIVE cte(n) as (select '1' from dual union all select n+1 from cte where n < 100) select * from cte; --error 3577 diff --git a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/recursive_mysql.test b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/recursive_mysql.test index 477adda938..21d210877f 100644 --- a/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/recursive_mysql.test +++ b/tools/deploy/mysql_test/test_suite/with_clause_mysql/t/recursive_mysql.test @@ -135,7 +135,7 @@ with RECURSIVE t4(a) as (select 1 from dual union all select a+1 from t4 where a ############################## ## PART 2.1 定义列名重复 ---error 5751 +--error 1060 with RECURSIVE cte(a,a) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte; ## PART 2.2.1 定义列数量与查询产生列一致或不一致 @@ -251,7 +251,6 @@ set @@ob_query_timeout=10000000; --error 5743 with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 union all select n+1 from cte where n < 2) select * from cte; ---error 5746 with RECURSIVE cte(n) as (select 1 from dual union all select c1 from t1 union all (with RECURSIVE cte(n) as (select c1 from t1) select * from cte)) select * from cte; --error 3577