[to #52329678]package variables cannot be called with brackets

This commit is contained in:
seuwebber 2023-12-28 11:18:24 +00:00 committed by ob-robot
parent 49ff3cae21
commit b8a08b5cbf
6 changed files with 37 additions and 3 deletions

View File

@ -13459,7 +13459,7 @@ int ObPLResolver::resolve_routine(ObObjAccessIdent &access_ident,
&& OB_FAIL(resolve_composite_access(access_ident, access_idxs, ns, func))) {
LOG_WARN("failed to access composite access", K(ret), K(access_ident), K(access_idxs));
}
if (OB_FAIL(ret)) {
if (OB_FAIL(ret) && OB_ERR_NOT_FUNC_NAME != ret) {
LOG_INFO("failed to resolve routine",
K(ret), K(database_name), K(package_name), K(routine_name), K(routine_type), K(access_ident), K(access_idxs));
ret = OB_ERR_FUNCTION_UNKNOWN;
@ -14087,6 +14087,19 @@ int ObPLResolver::resolve_access_ident(ObObjAccessIdent &access_ident, // 当前
access_ident.access_name_,
pl_data_type,
var_index);
if (ObPLExternalNS::PKG_VAR == type
&& cnt > 0) {
if (ObObjAccessIdx::IS_PKG_NS == access_idxs.at(cnt - 1).access_type_
&& access_ident.has_brackets_
&& access_ident.params_.count() == 0) {
ObSqlString object_name;
ObString empty_str;
construct_name(empty_str, access_idxs.at(cnt - 1).var_name_, access_ident.access_name_, object_name);
ret = OB_ERR_NOT_FUNC_NAME;
LOG_USER_ERROR(OB_ERR_NOT_FUNC_NAME, object_name.string().length(), object_name.string().ptr());
}
}
OZ (build_access_idx_sys_func(parent_id, access_idx));
OZ (access_idxs.push_back(access_idx), K(access_idx));
if (OB_FAIL(ret)) {

View File

@ -2332,6 +2332,9 @@ int ObPLBlockNS::find_sub_attr_by_name(const ObUserDefinedType &user_type,
if (OB_ISNULL(record_type.get_record_member_type(member_index))) {
ret = OB_ERR_UNEXPECTED;
LOG_WARN("type is invalid", K(ret));
} else if (access_ident.has_brackets_ && 0 == access_ident.params_.count()) {
ret = OB_ERR_NOT_FUNC_NAME;
LOG_USER_ERROR(OB_ERR_NOT_FUNC_NAME, attr_name.length(), attr_name.ptr());
} else {
new(&access_idx)ObObjAccessIdx(*record_type.get_record_member_type(member_index),
ObObjAccessIdx::IS_CONST, attr_name, *record_type.get_record_member_type(member_index),

File diff suppressed because one or more lines are too long

View File

@ -2389,6 +2389,7 @@ DEFINE_ORACLE_ERROR_EXT(OB_ERR_MVIEW_NEVER_REFRESH, -9761, -1, "HY000", "cannot
DEFINE_ERROR(OB_ERR_CLIENT_LOCAL_FILES_DISABLED, -9762, ER_CLIENT_LOCAL_FILES_DISABLED, "42000", "Loading local data is disabled; this must be enabled on both the client and server sides");
DEFINE_ORACLE_ERROR(OB_ERR_OUT_PARAM_NOT_BIND_VAR, -9763, -1, "HY000", "output parameter not a bind variable", 6577, "output parameter not a bind variable");
DEFINE_ORACLE_ERROR_EXT(OB_ERR_TIME_EARLIER_THAN_SYSDATE, -9764, -1, "HY000", "the parameter must evaluate to a time in the future", "the parameter %s must evaluate to a time in the future", 23420, "the parameter must evaluate to a time in the future", "the parameter %s must evaluate to a time in the future");
DEFINE_PLS_ERROR_EXT(OB_ERR_NOT_FUNC_NAME, -9765, -1, "HY000", "object 'string' must be of type function or array to be used this way", "object '%.*s' must be of type function or array to be used this way", 224, "object 'string' must be of type function or array to be used this way", "object '%.*s' must be of type function or array to be used this way");
////////////////////////////////////////////////////////////////
//error code for OBKV [-10500, -10700)

View File

@ -1813,6 +1813,7 @@ constexpr int OB_ERR_MVIEW_NEVER_REFRESH = -9761;
constexpr int OB_ERR_CLIENT_LOCAL_FILES_DISABLED = -9762;
constexpr int OB_ERR_OUT_PARAM_NOT_BIND_VAR = -9763;
constexpr int OB_ERR_TIME_EARLIER_THAN_SYSDATE = -9764;
constexpr int OB_ERR_NOT_FUNC_NAME = -9765;
constexpr int OB_ERR_KV_GLOBAL_INDEX_ROUTE = -10500;
constexpr int OB_TTL_NOT_ENABLE = -10501;
constexpr int OB_TTL_COLUMN_NOT_EXIST = -10502;
@ -4019,6 +4020,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_CLIENT_LOCAL_FILES_DISABLED__USER_ERROR_MSG "Loading local data is disabled; this must be enabled on both the client and server sides"
#define OB_ERR_OUT_PARAM_NOT_BIND_VAR__USER_ERROR_MSG "output parameter not a bind variable"
#define OB_ERR_TIME_EARLIER_THAN_SYSDATE__USER_ERROR_MSG "the parameter %s must evaluate to a time in the future"
#define OB_ERR_NOT_FUNC_NAME__USER_ERROR_MSG "object '%.*s' must be of type function or array to be used this way"
#define OB_ERR_KV_GLOBAL_INDEX_ROUTE__USER_ERROR_MSG "incorrect route for obkv global index, client router should refresh."
#define OB_TTL_NOT_ENABLE__USER_ERROR_MSG "TTL feature is not enabled"
#define OB_TTL_COLUMN_NOT_EXIST__USER_ERROR_MSG "TTL column '%.*s' not exists"
@ -6232,6 +6234,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_CLIENT_LOCAL_FILES_DISABLED__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9762, Loading local data is disabled; this must be enabled on both the client and server sides"
#define OB_ERR_OUT_PARAM_NOT_BIND_VAR__ORA_USER_ERROR_MSG "ORA-06577: output parameter not a bind variable"
#define OB_ERR_TIME_EARLIER_THAN_SYSDATE__ORA_USER_ERROR_MSG "ORA-23420: the parameter %s must evaluate to a time in the future"
#define OB_ERR_NOT_FUNC_NAME__ORA_USER_ERROR_MSG "PLS-00224: object '%.*s' must be of type function or array to be used this way"
#define OB_ERR_KV_GLOBAL_INDEX_ROUTE__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -10500, incorrect route for obkv global index, client router should refresh."
#define OB_TTL_NOT_ENABLE__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -10501, TTL feature is not enabled"
#define OB_TTL_COLUMN_NOT_EXIST__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -10502, TTL column '%.*s' not exists"
@ -6276,7 +6279,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
#define OB_ERR_DATA_TOO_LONG_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-12899: value too large for column %.*s (actual: %ld, maximum: %ld)"
#define OB_ERR_INVALID_DATE_MSG_FMT_V2__ORA_USER_ERROR_MSG "ORA-01861: Incorrect datetime value for column '%.*s' at row %ld"
extern int g_all_ob_errnos[2209];
extern int g_all_ob_errnos[2210];
const char *ob_error_name(const int oberr);
const char* ob_error_cause(const int oberr);

View File

@ -2054,6 +2054,7 @@ int ObRawExprResolverImpl::resolve_func_node_of_obj_access_idents(const ParseNod
ObObjAccessIdent &access_ident = q_name.access_idents_.at(q_name.access_idents_.count() - 1);
AccessNameType name_type = UNKNOWN;
access_ident.has_brackets_ = (1 == left_node.int16_values_[0]);
if (!q_name.is_unknown()) {
if (0 == access_ident.access_name_.case_compare("NEXT")
|| 0 == access_ident.access_name_.case_compare("PRIOR")