Bugfix46540552:fix mapping bugs for cte error code
This commit is contained in:
@ -935,6 +935,14 @@
|
|||||||
#define ER_TOO_BIG_ENUM 3504
|
#define ER_TOO_BIG_ENUM 3504
|
||||||
#define ER_TOO_LONG_SET_ENUM_VALUE 3505
|
#define ER_TOO_LONG_SET_ENUM_VALUE 3505
|
||||||
#define ER_TOO_MANY_TENANT_PARTITIONS_ERROR 3506
|
#define ER_TOO_MANY_TENANT_PARTITIONS_ERROR 3506
|
||||||
|
|
||||||
|
//for cte table
|
||||||
|
#define ER_CTE_RECURSIVE_REQUIRES_UNION 3573
|
||||||
|
#define ER_CTE_RECURSIVE_REQUIRES_NONRECURSIVE_FIRST 3574
|
||||||
|
#define ER_CTE_RECURSIVE_FORBIDS_AGGREGATION 3575
|
||||||
|
#define ER_CTE_RECURSIVE_FORBIDDEN_JOIN_ORDER 3576
|
||||||
|
#define ER_CTE_RECURSIVE_REQUIRES_SINGLE_REFERENCE 3577
|
||||||
|
|
||||||
#define ER_WINDOW_NO_CHILD_PARTITIONING 3581
|
#define ER_WINDOW_NO_CHILD_PARTITIONING 3581
|
||||||
#define ER_WINDOW_NO_INHERIT_FRAME 3582
|
#define ER_WINDOW_NO_INHERIT_FRAME 3582
|
||||||
#define ER_WINDOW_NO_REDEFINE_ORDER_BY 3583
|
#define ER_WINDOW_NO_REDEFINE_ORDER_BY 3583
|
||||||
|
|||||||
@ -13501,10 +13501,10 @@ static const _error _error_OB_ERR_CTE_COLUMN_NUMBER_NOT_MATCH = {
|
|||||||
.error_name = "OB_ERR_CTE_COLUMN_NUMBER_NOT_MATCH",
|
.error_name = "OB_ERR_CTE_COLUMN_NUMBER_NOT_MATCH",
|
||||||
.error_cause = "Internal Error",
|
.error_cause = "Internal Error",
|
||||||
.error_solution = "Contact OceanBase Support",
|
.error_solution = "Contact OceanBase Support",
|
||||||
.mysql_errno = -1,
|
.mysql_errno = ER_VIEW_WRONG_LIST,
|
||||||
.sqlstate = "HY000",
|
.sqlstate = "HY000",
|
||||||
.str_error = "number of WITH clause column names does not match number of elements in select list",
|
.str_error = "View's SELECT and view's field list have different column counts",
|
||||||
.str_user_error = "number of WITH clause column names does not match number of elements in select list",
|
.str_user_error = "View's SELECT and view's field list have different column counts",
|
||||||
.oracle_errno = 32038,
|
.oracle_errno = 32038,
|
||||||
.oracle_str_error = "ORA-32038: number of WITH clause column names does not match number of elements in select list",
|
.oracle_str_error = "ORA-32038: number of WITH clause column names does not match number of elements in select list",
|
||||||
.oracle_str_user_error = "ORA-32038: number of WITH clause column names does not match number of elements in select list"
|
.oracle_str_user_error = "ORA-32038: number of WITH clause column names does not match number of elements in select list"
|
||||||
@ -13525,7 +13525,7 @@ static const _error _error_OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE = {
|
|||||||
.error_name = "OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE",
|
.error_name = "OB_ERR_NEED_UNION_ALL_IN_RECURSIVE_CTE",
|
||||||
.error_cause = "Internal Error",
|
.error_cause = "Internal Error",
|
||||||
.error_solution = "Contact OceanBase Support",
|
.error_solution = "Contact OceanBase Support",
|
||||||
.mysql_errno = -1,
|
.mysql_errno = ER_CTE_RECURSIVE_REQUIRES_UNION,
|
||||||
.sqlstate = "HY000",
|
.sqlstate = "HY000",
|
||||||
.str_error = "recursive WITH clause must use a UNION ALL operation",
|
.str_error = "recursive WITH clause must use a UNION ALL operation",
|
||||||
.str_user_error = "recursive WITH clause must use a UNION ALL operation",
|
.str_user_error = "recursive WITH clause must use a UNION ALL operation",
|
||||||
@ -13549,10 +13549,10 @@ static const _error _error_OB_ERR_NEED_REFERENCE_ITSELF_DIRECTLY_IN_RECURSIVE_CT
|
|||||||
.error_name = "OB_ERR_NEED_REFERENCE_ITSELF_DIRECTLY_IN_RECURSIVE_CTE",
|
.error_name = "OB_ERR_NEED_REFERENCE_ITSELF_DIRECTLY_IN_RECURSIVE_CTE",
|
||||||
.error_cause = "Internal Error",
|
.error_cause = "Internal Error",
|
||||||
.error_solution = "Contact OceanBase Support",
|
.error_solution = "Contact OceanBase Support",
|
||||||
.mysql_errno = -1,
|
.mysql_errno = ER_CTE_RECURSIVE_REQUIRES_SINGLE_REFERENCE,
|
||||||
.sqlstate = "HY000",
|
.sqlstate = "HY000",
|
||||||
.str_error = "recursive WITH clause must reference itself directly in one of the UNION ALL branches",
|
.str_error = "In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery",
|
||||||
.str_user_error = "recursive WITH clause must reference itself directly in one of the UNION ALL branches",
|
.str_user_error = "In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery",
|
||||||
.oracle_errno = 32042,
|
.oracle_errno = 32042,
|
||||||
.oracle_str_error = "ORA-32042: recursive WITH clause must reference itself directly in one of the UNION ALL branches",
|
.oracle_str_error = "ORA-32042: recursive WITH clause must reference itself directly in one of the UNION ALL branches",
|
||||||
.oracle_str_user_error = "ORA-32042: recursive WITH clause must reference itself directly in one of the UNION ALL branches"
|
.oracle_str_user_error = "ORA-32042: recursive WITH clause must reference itself directly in one of the UNION ALL branches"
|
||||||
@ -13717,10 +13717,10 @@ static const _error _error_OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH = {
|
|||||||
.error_name = "OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH",
|
.error_name = "OB_ERR_CTE_ILLEGAL_RECURSIVE_BRANCH",
|
||||||
.error_cause = "Internal Error",
|
.error_cause = "Internal Error",
|
||||||
.error_solution = "Contact OceanBase Support",
|
.error_solution = "Contact OceanBase Support",
|
||||||
.mysql_errno = -1,
|
.mysql_errno = ER_CTE_RECURSIVE_FORBIDS_AGGREGATION,
|
||||||
.sqlstate = "HY000",
|
.sqlstate = "HY000",
|
||||||
.str_error = "unsupported operation in recursive branch of recursive WITH clause",
|
.str_error = "Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block",
|
||||||
.str_user_error = "unsupported operation in recursive branch of recursive WITH clause",
|
.str_user_error = "Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block",
|
||||||
.oracle_errno = 32486,
|
.oracle_errno = 32486,
|
||||||
.oracle_str_error = "ORA-32486: unsupported operation in recursive branch of recursive WITH clause",
|
.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"
|
.oracle_str_user_error = "ORA-32486: unsupported operation in recursive branch of recursive WITH clause"
|
||||||
@ -13729,10 +13729,10 @@ static const _error _error_OB_ERR_ILLEGAL_JOIN_IN_RECURSIVE_CTE = {
|
|||||||
.error_name = "OB_ERR_ILLEGAL_JOIN_IN_RECURSIVE_CTE",
|
.error_name = "OB_ERR_ILLEGAL_JOIN_IN_RECURSIVE_CTE",
|
||||||
.error_cause = "Internal Error",
|
.error_cause = "Internal Error",
|
||||||
.error_solution = "Contact OceanBase Support",
|
.error_solution = "Contact OceanBase Support",
|
||||||
.mysql_errno = -1,
|
.mysql_errno = ER_CTE_RECURSIVE_FORBIDDEN_JOIN_ORDER,
|
||||||
.sqlstate = "HY000",
|
.sqlstate = "HY000",
|
||||||
.str_error = "unsupported join in recursive WITH query",
|
.str_error = "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",
|
||||||
.str_user_error = "unsupported join in recursive WITH query",
|
.str_user_error = "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",
|
||||||
.oracle_errno = 32487,
|
.oracle_errno = 32487,
|
||||||
.oracle_str_error = "ORA-32487: unsupported join in recursive WITH query",
|
.oracle_str_error = "ORA-32487: unsupported join in recursive WITH query",
|
||||||
.oracle_str_user_error = "ORA-32487: unsupported join in recursive WITH query"
|
.oracle_str_user_error = "ORA-32487: unsupported join in recursive WITH query"
|
||||||
|
|||||||
@ -1242,11 +1242,11 @@ DEFINE_ORACLE_ERROR(OB_ERR_SIGNALED_IN_PARALLEL_QUERY_SERVER, -5736, -1, "HY000"
|
|||||||
DEFINE_ORACLE_ERROR(OB_ERR_CTE_ILLEGAL_QUERY_NAME, -5737, -1, "HY000", "illegal reference of a query name in WITH clause", 32031, "illegal reference of a query name in WITH clause");
|
DEFINE_ORACLE_ERROR(OB_ERR_CTE_ILLEGAL_QUERY_NAME, -5737, -1, "HY000", "illegal reference of a query name in WITH clause", 32031, "illegal reference of a query name in WITH clause");
|
||||||
DEFINE_ORACLE_ERROR(OB_ERR_CTE_UNSUPPORTED_COLUMN_ALIASING, -5738, -1, "HY000", "unsupported column aliasing", 32033, "unsupported column aliasing");
|
DEFINE_ORACLE_ERROR(OB_ERR_CTE_UNSUPPORTED_COLUMN_ALIASING, -5738, -1, "HY000", "unsupported column aliasing", 32033, "unsupported column aliasing");
|
||||||
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_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, -1, "HY000", "number of WITH clause column names does not match number of elements in select list", 32038, "number of WITH clause column names does not match number of elements in select list");
|
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_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, -1, "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_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_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_REFERENCE_ITSELF_DIRECTLY_IN_RECURSIVE_CTE, -5744, -1, "HY000", "recursive WITH clause must reference itself directly in one of the UNION ALL branches", 32042, "recursive WITH clause must reference itself directly in one of the UNION ALL 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_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");
|
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");
|
||||||
DEFINE_ORACLE_ERROR(OB_ERR_CTE_REACH_MAX_LEVEL_RECURSION, -5747, -1, "HY000", "maximum level of recursion reached while executing recursive WITH query", 32045, "maximum level of recursion reached while executing recursive WITH query");
|
DEFINE_ORACLE_ERROR(OB_ERR_CTE_REACH_MAX_LEVEL_RECURSION, -5747, -1, "HY000", "maximum level of recursion reached while executing recursive WITH query", 32045, "maximum level of recursion reached while executing recursive WITH query");
|
||||||
@ -1260,8 +1260,8 @@ 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_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_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_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, -1, "HY000", "unsupported operation in recursive branch of recursive WITH clause", 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", "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_ILLEGAL_JOIN_IN_RECURSIVE_CTE, -5759, -1, "HY000", "unsupported join in recursive WITH query", 32487, "unsupported join in recursive WITH query");
|
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_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");
|
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");
|
||||||
DEFINE_ORACLE_ERROR(OB_ERR_CTE_RECURSIVE_QUERY_NAME_REFERENCED_MORE_THAN_ONCE, -5762, -1, "HY000", "recursive query name referenced more than once in recursive branch of recursive WITH clause element", 32490, "recursive query name referenced more than once in recursive branch of recursive WITH clause element");
|
DEFINE_ORACLE_ERROR(OB_ERR_CTE_RECURSIVE_QUERY_NAME_REFERENCED_MORE_THAN_ONCE, -5762, -1, "HY000", "recursive query name referenced more than once in recursive branch of recursive WITH clause element", 32490, "recursive query name referenced more than once in recursive branch of recursive WITH clause element");
|
||||||
|
|||||||
@ -2731,11 +2731,11 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
|||||||
#define OB_ERR_CTE_ILLEGAL_QUERY_NAME__USER_ERROR_MSG "illegal reference of a query name in WITH clause"
|
#define OB_ERR_CTE_ILLEGAL_QUERY_NAME__USER_ERROR_MSG "illegal reference of a query name in WITH clause"
|
||||||
#define OB_ERR_CTE_UNSUPPORTED_COLUMN_ALIASING__USER_ERROR_MSG "unsupported column aliasing"
|
#define OB_ERR_CTE_UNSUPPORTED_COLUMN_ALIASING__USER_ERROR_MSG "unsupported column aliasing"
|
||||||
#define OB_ERR_UNSUPPORTED_USE_OF_CTE__USER_ERROR_MSG "unsupported use of WITH clause"
|
#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 "number of WITH clause column names does not match number of elements in select list"
|
#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_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_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_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_REFERENCE_ITSELF_DIRECTLY_IN_RECURSIVE_CTE__USER_ERROR_MSG "recursive WITH clause must reference itself directly in one of the UNION ALL branches"
|
#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_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"
|
#define OB_ERR_CYCLE_FOUND_IN_RECURSIVE_CTE__USER_ERROR_MSG "cycle detected while executing recursive WITH query"
|
||||||
#define OB_ERR_CTE_REACH_MAX_LEVEL_RECURSION__USER_ERROR_MSG "maximum level of recursion reached while executing recursive WITH query"
|
#define OB_ERR_CTE_REACH_MAX_LEVEL_RECURSION__USER_ERROR_MSG "maximum level of recursion reached while executing recursive WITH query"
|
||||||
@ -2749,8 +2749,8 @@ 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_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_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_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 "unsupported operation in recursive branch of recursive WITH clause"
|
#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_ILLEGAL_JOIN_IN_RECURSIVE_CTE__USER_ERROR_MSG "unsupported join in recursive WITH query"
|
#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_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"
|
#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"
|
||||||
#define OB_ERR_CTE_RECURSIVE_QUERY_NAME_REFERENCED_MORE_THAN_ONCE__USER_ERROR_MSG "recursive query name referenced more than once in recursive branch of recursive WITH clause element"
|
#define OB_ERR_CTE_RECURSIVE_QUERY_NAME_REFERENCED_MORE_THAN_ONCE__USER_ERROR_MSG "recursive query name referenced more than once in recursive branch of recursive WITH clause element"
|
||||||
|
|||||||
@ -148,10 +148,10 @@ with cte(a,b) as (select 1,1 from dual) select * from cte;
|
|||||||
+---+---+
|
+---+---+
|
||||||
|
|
||||||
with cte(a,b) as (select 1 from dual) select * from cte;
|
with cte(a,b) as (select 1 from dual) select * from cte;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
|
|
||||||
with cte(a,b,c) as (select 1, 2, 3, 4 from dual) select * from cte;
|
with cte(a,b,c) as (select 1, 2, 3, 4 from dual) select * from cte;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
|
|
||||||
## PART 2.2.2 不使用定义列使用原来的列
|
## PART 2.2.2 不使用定义列使用原来的列
|
||||||
with cte(a,b) as (select c1,c2 from t1) select c1 from cte;
|
with cte(a,b) as (select c1,c2 from t1) select c1 from cte;
|
||||||
@ -2251,7 +2251,7 @@ ERROR 23000: Column 'c21' in group statement is ambiguous
|
|||||||
with
|
with
|
||||||
cte1 (c22, c21) AS (select * from t1)
|
cte1 (c22, c21) AS (select * from t1)
|
||||||
select c22 as c21, c21 from cte1 group by c21;
|
select c22 as c21, c21 from cte1 group by c21;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
|
|
||||||
## cte的列名已经无法在被使用了,这种用法比较特殊
|
## cte的列名已经无法在被使用了,这种用法比较特殊
|
||||||
explain basic with cte as (select count(*) as k from t1) select * from cte where k = 1;
|
explain basic with cte as (select count(*) as k from t1) select * from cte where k = 1;
|
||||||
|
|||||||
@ -3,7 +3,7 @@ create database cte_st;
|
|||||||
use cte_st;
|
use cte_st;
|
||||||
result_format: 4
|
result_format: 4
|
||||||
with cte(a,b) as (select 1 from dual) select * from cte;
|
with cte(a,b) as (select 1 from dual) select * from cte;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
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;
|
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 doesn't exist
|
||||||
@ -78,18 +78,18 @@ with cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 ord
|
|||||||
ERROR 42S02: Table doesn't exist
|
ERROR 42S02: Table 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;
|
with RECURSIVE cte(n) as (select 1 union all select (select n+1 from cte where n < 1) ) select n from cte;
|
||||||
ERROR HY000: recursive WITH clause must reference itself directly in one of the UNION ALL branches
|
ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery
|
||||||
|
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select 1 + (select n+1 from cte where n < 1) from dual) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select 1 + (select n+1 from cte where n < 1) from dual) select n from cte;
|
||||||
ERROR HY000: recursive WITH clause must reference itself directly in one of the UNION ALL branches
|
ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery
|
||||||
|
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select -(select n+1 from cte where n < 1) from dual) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select -(select n+1 from cte where n < 1) from dual) select n from cte;
|
||||||
ERROR HY000: recursive WITH clause must reference itself directly in one of the UNION ALL branches
|
ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery
|
||||||
|
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select 2 as c1 from dual where c1 in (select n + 1 from cte where n < 10)) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select 2 as c1 from dual where c1 in (select n + 1 from cte where n < 10)) select n from cte;
|
||||||
ERROR HY000: recursive WITH clause must reference itself directly in one of the UNION ALL branches
|
ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery
|
||||||
|
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select 2 from dual where EXISTS(select n + 1 from cte where n < 10)) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select 2 from dual where EXISTS(select n + 1 from cte where n < 10)) select n from cte;
|
||||||
ERROR HY000: recursive WITH clause must reference itself directly in one of the UNION ALL branches
|
ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery
|
||||||
|
|
||||||
drop database cte_st;
|
drop database cte_st;
|
||||||
|
|||||||
@ -1028,11 +1028,11 @@ SELECT * FROM x;
|
|||||||
|
|
||||||
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT count(*) FROM x)
|
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT count(*) FROM x)
|
||||||
SELECT * FROM x;
|
SELECT * FROM x;
|
||||||
ERROR HY000: unsupported operation in recursive branch of recursive WITH clause
|
ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block
|
||||||
|
|
||||||
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT sum(n) FROM x)
|
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT sum(n) FROM x)
|
||||||
SELECT * FROM x;
|
SELECT * FROM x;
|
||||||
ERROR HY000: unsupported operation in recursive branch of recursive WITH clause
|
ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block
|
||||||
|
|
||||||
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;
|
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;
|
||||||
+------+
|
+------+
|
||||||
|
|||||||
@ -458,7 +458,7 @@ with RECURSIVE qn () as (select 1) select * from qn, qn qn1;
|
|||||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ') as (select 1) select * from qn, qn qn1' at line 1
|
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your OceanBase version for the right syntax to use near ') as (select 1) select * from qn, qn qn1' at line 1
|
||||||
# Materialization
|
# Materialization
|
||||||
with RECURSIVE qn (foo, bar) as (select 1 from dual) select * from qn, qn qn1;
|
with RECURSIVE qn (foo, bar) as (select 1 from dual) select * from qn, qn qn1;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
|
|
||||||
with RECURSIVE qn (foo, bar) as (select 1 as col, 2 as coll from dual union all
|
with RECURSIVE qn (foo, bar) as (select 1 as col, 2 as coll from dual union all
|
||||||
select a,b from t1) select qn1.bar from qn qn1;
|
select a,b from t1) select qn1.bar from qn qn1;
|
||||||
@ -472,7 +472,7 @@ with RECURSIVE qn (foo, bar) as (select 1 as col, 2 as coll from dual union all
|
|||||||
|
|
||||||
# Merge
|
# Merge
|
||||||
with RECURSIVE qn (foo, bar) as (select 1 from t1) select * from qn, qn qn1;
|
with RECURSIVE qn (foo, bar) as (select 1 from t1) select * from qn, qn qn1;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
with RECURSIVE qn (foo, bar) as (select 1, 2 from t1) select * from qn, qn qn1;
|
with RECURSIVE qn (foo, bar) as (select 1, 2 from t1) select * from qn, qn qn1;
|
||||||
+-----+-----+-----+-----+
|
+-----+-----+-----+-----+
|
||||||
| foo | bar | foo | bar |
|
| foo | bar | foo | bar |
|
||||||
@ -1666,9 +1666,9 @@ with RECURSIVE cte(a,b) as (select 1,1 from dual union all select a+1, a+1 from
|
|||||||
| 9 | 9 |
|
| 9 | 9 |
|
||||||
+------+------+
|
+------+------+
|
||||||
with RECURSIVE cte(a,b,c) 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,c) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
with RECURSIVE cte(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) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
with RECURSIVE cte(a,b,c) as
|
with RECURSIVE cte(a,b,c) as
|
||||||
(
|
(
|
||||||
select c1,c2,c3 from t1 where t1.c1 < 20
|
select c1,c2,c3 from t1 where t1.c1 < 20
|
||||||
@ -1752,7 +1752,7 @@ 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 WITH clause must use a UNION ALL operation
|
||||||
set @@ob_query_timeout=1000000;
|
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;
|
with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte;
|
||||||
ERROR HY000: unsupported operation in recursive branch of recursive WITH clause
|
ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block
|
||||||
set @@ob_query_timeout=10000000;
|
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;
|
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: UNION ALL operation in recursive WITH clause must have only two branches
|
||||||
@ -1865,16 +1865,16 @@ with RECURSIVE cte(n) as (select '1' from dual union all select n+1 from cte whe
|
|||||||
+------+
|
+------+
|
||||||
|
|
||||||
with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte;
|
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: recursive WITH clause must reference itself directly in one of the UNION ALL branches
|
ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery
|
||||||
set @@ob_query_timeout=1000000;
|
set @@ob_query_timeout=1000000;
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
set @@ob_query_timeout=10000000;
|
set @@ob_query_timeout=10000000;
|
||||||
|
|
||||||
with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 order by n ) select * from cte;
|
with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 order by n ) select * from cte;
|
||||||
@ -1929,7 +1929,7 @@ select c,d from cte2;
|
|||||||
explain basic with RECURSIVE
|
explain basic with RECURSIVE
|
||||||
cte2(c,d) AS (select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
|
cte2(c,d) AS (select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
|
||||||
select c1 from cte2;
|
select c1 from cte2;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
|
|
||||||
with RECURSIVE
|
with RECURSIVE
|
||||||
cte2(c,d) AS (select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
|
cte2(c,d) AS (select t1.c1, t2.c2 from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
|
||||||
|
|||||||
@ -158,9 +158,9 @@ with RECURSIVE cte(a,b) as (select 1,1 from dual union all select a+1, a+1 from
|
|||||||
+------+------+
|
+------+------+
|
||||||
|
|
||||||
with RECURSIVE cte(a,b,c) 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,c) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
with RECURSIVE cte(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) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte;
|
||||||
ERROR HY000: number of WITH clause column names does not match number of elements in select list
|
ERROR HY000: View's SELECT and view's field list have different column counts
|
||||||
|
|
||||||
## PART 2.2.2 不使用定义列使用原来的列
|
## PART 2.2.2 不使用定义列使用原来的列
|
||||||
with RECURSIVE cte(a,b,c) as
|
with RECURSIVE cte(a,b,c) as
|
||||||
@ -981,7 +981,7 @@ ERROR HY000: recursive WITH clause must use a UNION ALL operation
|
|||||||
|
|
||||||
set @@ob_query_timeout=1000000;
|
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;
|
with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte;
|
||||||
ERROR HY000: unsupported operation in recursive branch of recursive WITH clause
|
ERROR HY000: Recursive Common Table Expression can contain neither aggregation nor window functions in recursive query block
|
||||||
|
|
||||||
set @@ob_query_timeout=10000000;
|
set @@ob_query_timeout=10000000;
|
||||||
|
|
||||||
@ -993,17 +993,17 @@ with RECURSIVE cte(n) as (select 1 from dual union all select c1 from t1 union a
|
|||||||
ERROR HY000: cycle detected while executing recursive WITH query
|
ERROR HY000: cycle detected while executing recursive WITH query
|
||||||
|
|
||||||
with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte;
|
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: recursive WITH clause must reference itself directly in one of the UNION ALL branches
|
ERROR HY000: In recursive query block of Recursive Common Table Expression, the recursive table must be referenced only once, and not in any subquery
|
||||||
|
|
||||||
## 不能出现在right join的左边,left join的右边,full join的两边
|
## 不能出现在right join的左边,left join的右边,full join的两边
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
ERROR HY000: unsupported join in recursive WITH query
|
ERROR 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
|
||||||
set @@ob_query_timeout=10000000;
|
set @@ob_query_timeout=10000000;
|
||||||
|
|
||||||
## PART 4.2 左支不停的变化
|
## PART 4.2 左支不停的变化
|
||||||
|
|||||||
@ -117,10 +117,10 @@ with cte(a,a) as (select 1,1 from dual) select * from cte;
|
|||||||
explain basic with cte(a,b) as (select 1,1 from dual) select * from cte;
|
explain basic with cte(a,b) as (select 1,1 from dual) select * from cte;
|
||||||
with cte(a,b) as (select 1,1 from dual) select * from cte;
|
with cte(a,b) as (select 1,1 from dual) select * from cte;
|
||||||
|
|
||||||
--error 5740
|
--error 1353
|
||||||
with cte(a,b) as (select 1 from dual) select * from cte;
|
with cte(a,b) as (select 1 from dual) select * from cte;
|
||||||
|
|
||||||
--error 5740
|
--error 1353
|
||||||
with cte(a,b,c) as (select 1, 2, 3, 4 from dual) select * from cte;
|
with cte(a,b,c) as (select 1, 2, 3, 4 from dual) select * from cte;
|
||||||
|
|
||||||
--echo ## PART 2.2.2 不使用定义列使用原来的列
|
--echo ## PART 2.2.2 不使用定义列使用原来的列
|
||||||
@ -690,7 +690,7 @@ select c22 as c21, c21 from cte1 having c21 > 0;
|
|||||||
with
|
with
|
||||||
cte1 (c22, c21) AS (select c1, c2 from t1)
|
cte1 (c22, c21) AS (select c1, c2 from t1)
|
||||||
select c22 as c21, c21 from cte1 group by c21;
|
select c22 as c21, c21 from cte1 group by c21;
|
||||||
--error 5740
|
--error 1353
|
||||||
with
|
with
|
||||||
cte1 (c22, c21) AS (select * from t1)
|
cte1 (c22, c21) AS (select * from t1)
|
||||||
select c22 as c21, c21 from cte1 group by c21;
|
select c22 as c21, c21 from cte1 group by c21;
|
||||||
|
|||||||
@ -9,7 +9,7 @@ create database cte_st;
|
|||||||
use cte_st;
|
use cte_st;
|
||||||
|
|
||||||
--result_format 4
|
--result_format 4
|
||||||
--error 5740
|
--error 1353
|
||||||
with cte(a,b) as (select 1 from dual) select * from cte;
|
with cte(a,b) as (select 1 from dual) select * from cte;
|
||||||
|
|
||||||
--error 1146
|
--error 1146
|
||||||
@ -80,19 +80,19 @@ with cte(n) AS ( select 1 from cte) select * from cte;
|
|||||||
--error 1146
|
--error 1146
|
||||||
with cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 order by n ) select * from cte;
|
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 5744
|
--error 3577
|
||||||
with RECURSIVE cte(n) as (select 1 union all select (select n+1 from cte where n < 1) ) select n from cte;
|
with RECURSIVE cte(n) as (select 1 union all select (select n+1 from cte where n < 1) ) select n from cte;
|
||||||
|
|
||||||
--error 5744
|
--error 3577
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select 1 + (select n+1 from cte where n < 1) from dual) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select 1 + (select n+1 from cte where n < 1) from dual) select n from cte;
|
||||||
|
|
||||||
--error 5744
|
--error 3577
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select -(select n+1 from cte where n < 1) from dual) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select -(select n+1 from cte where n < 1) from dual) select n from cte;
|
||||||
|
|
||||||
--error 5744
|
--error 3577
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select 2 as c1 from dual where c1 in (select n + 1 from cte where n < 10)) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select 2 as c1 from dual where c1 in (select n + 1 from cte where n < 10)) select n from cte;
|
||||||
|
|
||||||
--error 5744
|
--error 3577
|
||||||
with RECURSIVE cte(n) as (select 1 from dual union all select 2 from dual where EXISTS(select n + 1 from cte where n < 10)) select n from cte;
|
with RECURSIVE cte(n) as (select 1 from dual union all select 2 from dual where EXISTS(select n + 1 from cte where n < 10)) select n from cte;
|
||||||
|
|
||||||
drop database cte_st;
|
drop database cte_st;
|
||||||
@ -547,11 +547,11 @@ with RECURSIVE x(n) AS (SELECT a FROM y WHERE a = 1
|
|||||||
SELECT x.n+1 FROM y RIGHT JOIN x ON x.n = y.a WHERE n < 10)
|
SELECT x.n+1 FROM y RIGHT JOIN x ON x.n = y.a WHERE n < 10)
|
||||||
SELECT * FROM x;
|
SELECT * FROM x;
|
||||||
|
|
||||||
--error 5758
|
--error 3575
|
||||||
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT count(*) FROM x)
|
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT count(*) FROM x)
|
||||||
SELECT * FROM x;
|
SELECT * FROM x;
|
||||||
|
|
||||||
--error 5758
|
--error 3575
|
||||||
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT sum(n) FROM x)
|
with RECURSIVE x(n) AS (SELECT 1 from dual UNION ALL SELECT sum(n) FROM x)
|
||||||
SELECT * FROM x;
|
SELECT * FROM x;
|
||||||
|
|
||||||
|
|||||||
@ -60,7 +60,7 @@ qn AS (SELECT b as a FROM qn2)
|
|||||||
SELECT qn.a FROM qn;
|
SELECT qn.a FROM qn;
|
||||||
|
|
||||||
--echo # recursive
|
--echo # recursive
|
||||||
--error 5742
|
--error 3573
|
||||||
with recursive qn AS (SELECT a FROM qn)
|
with recursive qn AS (SELECT a FROM qn)
|
||||||
SELECT qn.a FROM qn;
|
SELECT qn.a FROM qn;
|
||||||
|
|
||||||
@ -233,7 +233,7 @@ select * from t1 where t1.a in (select a+0 from cte);
|
|||||||
--error 1064
|
--error 1064
|
||||||
with RECURSIVE qn () as (select 1) select * from qn, qn qn1;
|
with RECURSIVE qn () as (select 1) select * from qn, qn qn1;
|
||||||
--echo # Materialization
|
--echo # Materialization
|
||||||
--error 5740
|
--error 1353
|
||||||
with RECURSIVE qn (foo, bar) as (select 1 from dual) select * from qn, qn qn1;
|
with RECURSIVE qn (foo, bar) as (select 1 from dual) select * from qn, qn qn1;
|
||||||
|
|
||||||
with RECURSIVE qn (foo, bar) as (select 1 as col, 2 as coll from dual union all
|
with RECURSIVE qn (foo, bar) as (select 1 as col, 2 as coll from dual union all
|
||||||
@ -241,7 +241,7 @@ with RECURSIVE qn (foo, bar) as (select 1 as col, 2 as coll from dual union all
|
|||||||
|
|
||||||
|
|
||||||
--echo # Merge
|
--echo # Merge
|
||||||
--error 5740
|
--error 1353
|
||||||
with RECURSIVE qn (foo, bar) as (select 1 from t1) select * from qn, qn qn1;
|
with RECURSIVE qn (foo, bar) as (select 1 from t1) select * from qn, qn qn1;
|
||||||
with RECURSIVE qn (foo, bar) as (select 1, 2 from t1) select * from qn, qn qn1;
|
with RECURSIVE qn (foo, bar) as (select 1, 2 from t1) select * from qn, qn qn1;
|
||||||
|
|
||||||
@ -1032,9 +1032,9 @@ with RECURSIVE t4(a) as (select 1 from dual union all select a+1 from t4 where a
|
|||||||
--error 5751
|
--error 5751
|
||||||
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,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;
|
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 5740
|
--error 1353
|
||||||
with RECURSIVE cte(a,b,c) 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,c) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte;
|
||||||
--error 5740
|
--error 1353
|
||||||
with RECURSIVE cte(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) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte;
|
||||||
--error 1054
|
--error 1054
|
||||||
with RECURSIVE cte(a,b,c) as
|
with RECURSIVE cte(a,b,c) as
|
||||||
@ -1095,10 +1095,10 @@ select * from cte;
|
|||||||
with RECURSIVE cte(a) as (select 1 from dual union all select 2 from dual), cte_1(b) as (select 1 from dual union all select * from cte) select * from cte_1;
|
with RECURSIVE cte(a) as (select 1 from dual union all select 2 from dual), cte_1(b) as (select 1 from dual union all select * from cte) select * from cte_1;
|
||||||
--error 5743
|
--error 5743
|
||||||
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;
|
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 5742
|
--error 3573
|
||||||
with RECURSIVE cte(n) AS ( select 1 from cte) select * from cte;
|
with RECURSIVE cte(n) AS ( select 1 from cte) select * from cte;
|
||||||
set @@ob_query_timeout=1000000;
|
set @@ob_query_timeout=1000000;
|
||||||
--error 5758
|
--error 3575
|
||||||
with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte;
|
with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte;
|
||||||
set @@ob_query_timeout=10000000;
|
set @@ob_query_timeout=10000000;
|
||||||
--error 5743
|
--error 5743
|
||||||
@ -1107,16 +1107,16 @@ with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where
|
|||||||
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;
|
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;
|
||||||
with RECURSIVE cte(n) as (select '1' from dual union all select n+1 from cte where n < 100) select * from cte;
|
with RECURSIVE cte(n) as (select '1' from dual union all select n+1 from cte where n < 100) select * from cte;
|
||||||
|
|
||||||
--error 5744
|
--error 3577
|
||||||
with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte;
|
with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte;
|
||||||
set @@ob_query_timeout=1000000;
|
set @@ob_query_timeout=1000000;
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
set @@ob_query_timeout=10000000;
|
set @@ob_query_timeout=10000000;
|
||||||
|
|
||||||
@ -1153,7 +1153,7 @@ with RECURSIVE
|
|||||||
cte2(c,d) AS (select c1, c2 + 1 as c3 from t1 order by c2 union all select c+1, d+1 from cte2 where c < 30)
|
cte2(c,d) AS (select c1, c2 + 1 as c3 from t1 order by c2 union all select c+1, d+1 from cte2 where c < 30)
|
||||||
select c,d from cte2;
|
select c,d from cte2;
|
||||||
|
|
||||||
--error 5740
|
--error 1353
|
||||||
explain basic with RECURSIVE
|
explain basic with RECURSIVE
|
||||||
cte2(c,d) AS (select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
|
cte2(c,d) AS (select * from t1 left join t2 on t1.c1=t2.c1 order by t1.c1 union all select c+1, d+1 from cte2 where c < 30)
|
||||||
select c1 from cte2;
|
select c1 from cte2;
|
||||||
|
|||||||
@ -141,9 +141,9 @@ with RECURSIVE cte(a,a) as (select 1,1 from dual union all select a+1, a+1 from
|
|||||||
## PART 2.2.1 定义列数量与查询产生列一致或不一致
|
## 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;
|
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 5740
|
--error 1353
|
||||||
with RECURSIVE cte(a,b,c) 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,c) as (select 1,1 from dual union all select a+1, a+1 from cte where a+1 < 10) select * from cte;
|
||||||
--error 5740
|
--error 1353
|
||||||
with RECURSIVE cte(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) 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.2 不使用定义列使用原来的列
|
## PART 2.2.2 不使用定义列使用原来的列
|
||||||
@ -238,11 +238,11 @@ with RECURSIVE cte(a) as (select 1 from dual union all select 2 from dual), 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;
|
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;
|
||||||
|
|
||||||
## 递归必须包含union all
|
## 递归必须包含union all
|
||||||
--error 5742
|
--error 3573
|
||||||
with RECURSIVE cte(n) AS ( select 1 from cte) select * from cte;
|
with RECURSIVE cte(n) AS ( select 1 from cte) select * from cte;
|
||||||
|
|
||||||
set @@ob_query_timeout=1000000;
|
set @@ob_query_timeout=1000000;
|
||||||
--error 5758
|
--error 3575
|
||||||
with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte;
|
with RECURSIVE cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte;
|
||||||
|
|
||||||
set @@ob_query_timeout=10000000;
|
set @@ob_query_timeout=10000000;
|
||||||
@ -254,17 +254,17 @@ with RECURSIVE cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where
|
|||||||
--error 5746
|
--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;
|
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 5744
|
--error 3577
|
||||||
with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte;
|
with RECURSIVE cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte;
|
||||||
|
|
||||||
## 不能出现在right join的左边,left join的右边,full join的两边
|
## 不能出现在right join的左边,left join的右边,full join的两边
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
--error 5759
|
--error 3576
|
||||||
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
with RECURSIVE cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte;
|
||||||
set @@ob_query_timeout=10000000;
|
set @@ob_query_timeout=10000000;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user