[to #48644798] fix mysql errno for creating views with questionmarks in PL

This commit is contained in:
0xacc
2023-05-25 18:11:48 +00:00
committed by ob-robot
parent 6076783094
commit 6de40b6e88
9 changed files with 46 additions and 5 deletions

View File

@ -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)))) {

View File

@ -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_*/

View File

@ -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*/

View File

@ -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); }