diff --git a/src/share/ob_errno.cpp b/src/share/ob_errno.cpp index a92bc0fc4..e565331a0 100644 --- a/src/share/ob_errno.cpp +++ b/src/share/ob_errno.cpp @@ -11937,6 +11937,18 @@ static const _error _error_OB_ERR_TABLE_NAME_NOT_IN_LIST = { .oracle_str_error = "ORA-00964: table name not in FROM list", .oracle_str_user_error = "ORA-00964: table name not in FROM list" }; +static const _error _error_OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART = { + .error_name = "OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART", + .error_cause = "Internal Error", + .error_solution = "Contact OceanBase Support", + .mysql_errno = -1, + .sqlstate = "42000", + .str_error = "DEFAULT partition must be last partition specified", + .str_user_error = "DEFAULT partition must be last partition specified", + .oracle_errno = 14318, + .oracle_str_error = "ORA-14318: DEFAULT partition must be last partition specified", + .oracle_str_user_error = "ORA-14318: DEFAULT partition must be last partition specified" +}; static const _error _error_OB_ERR_SP_ALREADY_EXISTS = { .error_name = "OB_ERR_SP_ALREADY_EXISTS", .error_cause = "Internal Error", @@ -25345,6 +25357,7 @@ struct ObStrErrorInit _errors[-OB_ERR_INVALID_ARGUMENT_FOR_JSON_CALL] = &_error_OB_ERR_INVALID_ARGUMENT_FOR_JSON_CALL; _errors[-OB_ERR_SCHEMA_HISTORY_EMPTY] = &_error_OB_ERR_SCHEMA_HISTORY_EMPTY; _errors[-OB_ERR_TABLE_NAME_NOT_IN_LIST] = &_error_OB_ERR_TABLE_NAME_NOT_IN_LIST; + _errors[-OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART] = &_error_OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART; _errors[-OB_ERR_SP_ALREADY_EXISTS] = &_error_OB_ERR_SP_ALREADY_EXISTS; _errors[-OB_ERR_SP_DOES_NOT_EXIST] = &_error_OB_ERR_SP_DOES_NOT_EXIST; _errors[-OB_ERR_SP_UNDECLARED_VAR] = &_error_OB_ERR_SP_UNDECLARED_VAR; diff --git a/src/share/ob_errno.def b/src/share/ob_errno.def index 1263073d7..46b5f145c 100644 --- a/src/share/ob_errno.def +++ b/src/share/ob_errno.def @@ -1102,6 +1102,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_PATH_EXPRESSION_NOT_LITERAL, -5487, -1, "42000", "pat DEFINE_PLS_ERROR_EXT(OB_ERR_INVALID_ARGUMENT_FOR_JSON_CALL, -5488, -1, "HY000", "invalid argument for JSON call", "invalid argument for %s call", 185, "invalid argument for JSON call", "invalid argument for %s call"); DEFINE_ERROR(OB_ERR_SCHEMA_HISTORY_EMPTY, -5489, -1, "HY000", "Schema history is empty"); DEFINE_ORACLE_ERROR(OB_ERR_TABLE_NAME_NOT_IN_LIST, -5490, -1, "42000", "table name not in FROM list", 964, "table name not in FROM list")); +DEFINE_ORACLE_ERROR(OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART, -5491, -1, "42000", "DEFAULT partition must be last partition specified", 14318, "DEFAULT partition must be last partition specified")); DEFINE_ERROR_EXT(OB_ERR_SP_ALREADY_EXISTS, -5541, ER_SP_ALREADY_EXISTS, "42000", "procedure/function already exists", "%s %.*s already exists"); DEFINE_ERROR_EXT(OB_ERR_SP_DOES_NOT_EXIST, -5542, ER_SP_DOES_NOT_EXIST, "42000", "procedure/function does not exist", "%s %.*s.%.*s does not exist"); diff --git a/src/share/ob_errno.h b/src/share/ob_errno.h index 4ed6b560d..5cf22429c 100644 --- a/src/share/ob_errno.h +++ b/src/share/ob_errno.h @@ -826,6 +826,7 @@ constexpr int OB_ERR_PATH_EXPRESSION_NOT_LITERAL = -5487; constexpr int OB_ERR_INVALID_ARGUMENT_FOR_JSON_CALL = -5488; constexpr int OB_ERR_SCHEMA_HISTORY_EMPTY = -5489; constexpr int OB_ERR_TABLE_NAME_NOT_IN_LIST = -5490; +constexpr int OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART = -5491; constexpr int OB_ERR_SP_ALREADY_EXISTS = -5541; constexpr int OB_ERR_SP_DOES_NOT_EXIST = -5542; constexpr int OB_ERR_SP_UNDECLARED_VAR = -5543; @@ -4720,6 +4721,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219; #define OB_ERR_INVALID_ARGUMENT_FOR_JSON_CALL__ORA_USER_ERROR_MSG "PLS-00185: invalid argument for %s call" #define OB_ERR_SCHEMA_HISTORY_EMPTY__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5489, Schema history is empty" #define OB_ERR_TABLE_NAME_NOT_IN_LIST__ORA_USER_ERROR_MSG "ORA-00964: table name not in FROM list" +#define OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART__ORA_USER_ERROR_MSG "ORA-14318: DEFAULT partition must be last partition specified" #define OB_ERR_SP_ALREADY_EXISTS__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5541, %s %.*s already exists" #define OB_ERR_SP_DOES_NOT_EXIST__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -5542, %s %.*s.%.*s does not exist" #define OB_ERR_SP_UNDECLARED_VAR__ORA_USER_ERROR_MSG "PLS-00201: identifier '%.*s' must be declared" diff --git a/src/sql/engine/cmd/ob_partition_executor_utils.cpp b/src/sql/engine/cmd/ob_partition_executor_utils.cpp index 0de5586e4..fbdd8dd15 100644 --- a/src/sql/engine/cmd/ob_partition_executor_utils.cpp +++ b/src/sql/engine/cmd/ob_partition_executor_utils.cpp @@ -283,7 +283,9 @@ int ObPartitionExecutorUtils::cast_list_expr_to_obj( LOG_WARN("get unexpected expr", K(ret), K(value_expr)); } else if (ObMaxType == value_expr->get_data_type()) { ++default_count; - if (row_expr->get_param_count() != 1) { + if (i != list_values_exprs.count() - 1) { + ret = OB_ERR_DEFAULT_NOT_AT_LAST_IN_LIST_PART; + } else if (row_expr->get_param_count() != 1) { ret = OB_ERR_MULTIPLE_DEF_CONST_IN_LIST_PART; } else if (default_count > 1) { ret = OB_ERR_MULTIPLE_DEF_CONST_IN_LIST_PART;