[to #48644798] fix mysql errno for creating views with questionmarks in PL
This commit is contained in:
@ -88,7 +88,8 @@ int ObPLRouter::check_error_in_resolve(int code)
|
||||
case OB_ERR_SP_NO_DROP_SP:
|
||||
case OB_ERR_SP_BAD_CONDITION_TYPE:
|
||||
case OB_ERR_DUP_SIGNAL_SET:
|
||||
case OB_ERR_CANNOT_UPDATE_VIRTUAL_COL_IN_TRG: {
|
||||
case OB_ERR_CANNOT_UPDATE_VIRTUAL_COL_IN_TRG:
|
||||
case OB_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK: {
|
||||
if (lib::is_mysql_mode()) {
|
||||
ret = code;
|
||||
break;
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -2275,6 +2275,7 @@ DEFINE_ORACLE_ERROR(OB_ERR_RECOMPILATION_OBJECT, -9744, -1, "HY000", "errors dur
|
||||
DEFINE_ORACLE_ERROR(OB_ERR_VARIABLE_NOT_IN_SELECT_LIST, -9745, -1, "HY000", "variable not in select list", 1007, "variable not in select list");
|
||||
DEFINE_ORACLE_ERROR(OB_ERR_MULTI_RECORD, -9746, -1, "HY000", "coercion into multiple record targets not supported", 494, "coercion into multiple record targets not supported");
|
||||
DEFINE_ERROR(OB_ERR_MALFORMED_PS_PACKET, -9747, -1, "HY000", "malformed ps packet");
|
||||
DEFINE_ERROR(OB_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK, -9748, 1351, "HY000", "View's SELECT contains a variable or parameter");
|
||||
////////////////////////////////////////////////////////////////
|
||||
// !!! text/blob || clob/blob erro code
|
||||
// for compat we cant not remove this errno!!!!
|
||||
|
||||
@ -1736,6 +1736,7 @@ constexpr int OB_ERR_RECOMPILATION_OBJECT = -9744;
|
||||
constexpr int OB_ERR_VARIABLE_NOT_IN_SELECT_LIST = -9745;
|
||||
constexpr int OB_ERR_MULTI_RECORD = -9746;
|
||||
constexpr int OB_ERR_MALFORMED_PS_PACKET = -9747;
|
||||
constexpr int OB_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK = -9748;
|
||||
constexpr int OB_SP_RAISE_APPLICATION_ERROR = -20000;
|
||||
constexpr int OB_SP_RAISE_APPLICATION_ERROR_NUM = -21000;
|
||||
constexpr int OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN = -22998;
|
||||
@ -3816,6 +3817,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ERR_VARIABLE_NOT_IN_SELECT_LIST__USER_ERROR_MSG "variable not in select list"
|
||||
#define OB_ERR_MULTI_RECORD__USER_ERROR_MSG "coercion into multiple record targets not supported"
|
||||
#define OB_ERR_MALFORMED_PS_PACKET__USER_ERROR_MSG "malformed ps packet"
|
||||
#define OB_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK__USER_ERROR_MSG "View's SELECT contains a variable or parameter"
|
||||
#define OB_SP_RAISE_APPLICATION_ERROR__USER_ERROR_MSG "%.*s"
|
||||
#define OB_SP_RAISE_APPLICATION_ERROR_NUM__USER_ERROR_MSG "error number argument to raise_application_error of '%d' is out of range"
|
||||
#define OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN__USER_ERROR_MSG "CLOB or NCLOB in multibyte character set not supported"
|
||||
@ -5896,6 +5898,7 @@ constexpr int OB_ERR_INVALID_DATE_MSG_FMT_V2 = -4219;
|
||||
#define OB_ERR_VARIABLE_NOT_IN_SELECT_LIST__ORA_USER_ERROR_MSG "ORA-01007: variable not in select list"
|
||||
#define OB_ERR_MULTI_RECORD__ORA_USER_ERROR_MSG "ORA-00494: coercion into multiple record targets not supported"
|
||||
#define OB_ERR_MALFORMED_PS_PACKET__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9747, malformed ps packet"
|
||||
#define OB_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK__ORA_USER_ERROR_MSG "ORA-00600: internal error code, arguments: -9748, View's SELECT contains a variable or parameter"
|
||||
#define OB_SP_RAISE_APPLICATION_ERROR__ORA_USER_ERROR_MSG "ORA%06ld: %.*s"
|
||||
#define OB_SP_RAISE_APPLICATION_ERROR_NUM__ORA_USER_ERROR_MSG "ORA-21000: error number argument to raise_application_error of '%d' is out of range"
|
||||
#define OB_CLOB_ONLY_SUPPORT_WITH_MULTIBYTE_FUN__ORA_USER_ERROR_MSG "ORA-22998: CLOB or NCLOB in multibyte character set not supported"
|
||||
@ -5906,7 +5909,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[2076];
|
||||
extern int g_all_ob_errnos[2077];
|
||||
|
||||
const char *ob_error_name(const int oberr);
|
||||
const char* ob_error_cause(const int oberr);
|
||||
|
||||
@ -1245,7 +1245,7 @@ int ObSql::handle_pl_prepare(const ObString &sql,
|
||||
LOG_WARN("failed to write string", K(ret));
|
||||
} else if (OB_FAIL(sess.store_query_string(trimed_stmt))) {
|
||||
LOG_WARN("store query string fail", K(ret));
|
||||
} else if (OB_FAIL(parser.parse(sql, parse_result, parse_mode, false, false))) {
|
||||
} else if (OB_FAIL(parser.parse(sql, parse_result, parse_mode, false, false, true))) {
|
||||
LOG_WARN("generate syntax tree failed", K(sql), K(ret));
|
||||
} else if (is_mysql_mode() && ObSQLUtils::is_mysql_ps_not_support_stmt(parse_result)) {
|
||||
ret = OB_ER_UNSUPPORTED_PS;
|
||||
@ -3938,6 +3938,7 @@ int ObSql::parser_and_check(const ObString &outlined_stmt,
|
||||
|| OB_ERR_CONSTRUCT_MUST_RETURN_SELF == ret
|
||||
|| OB_ERR_ONLY_FUNC_CAN_PIPELINED == ret
|
||||
|| OB_ERR_NO_ATTR_FOUND == ret
|
||||
|| OB_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK == ret
|
||||
|| OB_ERR_NON_INT_LITERAL == ret
|
||||
|| OB_ERR_PARSER_INIT == ret
|
||||
|| OB_NOT_SUPPORTED == ret)) {
|
||||
|
||||
@ -1041,6 +1041,8 @@ int ObParser::parse(const ObString &query,
|
||||
parse_result.question_mark_ctx_.count_ = def_name_ctx_->count_;
|
||||
}
|
||||
|
||||
parse_result.pl_parse_info_.is_inner_parse_ = is_pl_inner_parse;
|
||||
|
||||
if (INS_MULTI_VALUES == parse_mode) {
|
||||
void *buffer = nullptr;
|
||||
if (OB_ISNULL(buffer = allocator_->alloc(sizeof(InsMultiValuesResult)))) {
|
||||
|
||||
@ -37,4 +37,5 @@ static const int32_t OB_PARSER_ERR_NUMERIC_OR_VALUE_ERROR = -5677;
|
||||
static const int32_t OB_PARSER_ERR_NON_INTEGRAL_NUMERIC_LITERAL = -9670;
|
||||
static const int32_t OB_PARSER_ERR_UNDECLARED_VAR = -5543;
|
||||
static const int32_t OB_PARSER_ERR_UNSUPPORTED = -4007;
|
||||
static const int32_t OB_PARSER_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK = -9748;
|
||||
#endif /*OCEANBASE_SQL_PARSER_PARSE_DEFINE_*/
|
||||
|
||||
@ -216,6 +216,7 @@ typedef struct _PLParseInfo
|
||||
bool is_pl_parse_;//用于标识当前parser逻辑是否为PLParse调用
|
||||
bool is_pl_parse_expr_; //用于标识当前parser逻辑是否在解析PLParser的expr
|
||||
bool is_forbid_pl_fp_;
|
||||
bool is_inner_parse_;
|
||||
int last_pl_symbol_pos_; //上一个pl变量的结束位置
|
||||
int plsql_line_;
|
||||
/*for mysql pl*/
|
||||
|
||||
@ -601,7 +601,25 @@ stmt:
|
||||
| drop_index_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| kill_stmt { $$ = $1; question_mark_issue($$, result); }
|
||||
| help_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| create_view_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| create_view_stmt
|
||||
{
|
||||
$$ = $1;
|
||||
|
||||
if (OB_UNLIKELY(NULL == $$ || NULL == result)) {
|
||||
yyerror(NULL, result, "node or result is NULL\n");
|
||||
YYABORT_UNEXPECTED;
|
||||
} else if (OB_UNLIKELY(!result->pl_parse_info_.is_pl_parse_ && 0 != result->question_mark_ctx_.count_)) {
|
||||
if (result->pl_parse_info_.is_inner_parse_) {
|
||||
result->extra_errno_ = OB_PARSER_ERR_VIEW_SELECT_CONTAIN_QUESTIONMARK;
|
||||
YYABORT;
|
||||
} else {
|
||||
yyerror(NULL, result, "Unknown column '?'\n");
|
||||
YYABORT_PARSE_SQL_ERROR;
|
||||
}
|
||||
} else {
|
||||
$$->value_ = result->question_mark_ctx_.count_;
|
||||
}
|
||||
}
|
||||
| create_tenant_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| create_standby_tenant_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
| alter_tenant_stmt { $$ = $1; check_question_mark($$, result); }
|
||||
|
||||
Reference in New Issue
Block a user