fix some parser bug
This commit is contained in:
parent
1da48d991e
commit
9ce10fcef5
@ -1447,7 +1447,8 @@ int ObPL::parameter_anonymous_block(ObExecContext &ctx,
|
||||
ObString pc_key;
|
||||
ParseResult parse_result;
|
||||
ObPLParser pl_parser(allocator,
|
||||
ctx.get_my_session()->get_dtc_params().connection_collation_);
|
||||
ctx.get_my_session()->get_dtc_params().connection_collation_,
|
||||
ctx.get_my_session()->get_sql_mode());
|
||||
OZ (pl_parser.fast_parse(sql, parse_result));
|
||||
if (OB_SUCC(ret)) {
|
||||
PlTransformTreeCtx trans_ctx;
|
||||
|
@ -338,7 +338,7 @@ int ObPLCompiler::compile(const uint64_t id, ObPLFunction &func)
|
||||
if (OB_SUCC(ret)) {
|
||||
ObString body = proc->get_routine_body(); //获取body字符串
|
||||
ObDataTypeCastParams dtc_params = session_info_.get_dtc_params();
|
||||
ObPLParser parser(allocator_, dtc_params.connection_collation_);
|
||||
ObPLParser parser(allocator_, dtc_params.connection_collation_, session_info_.get_sql_mode());
|
||||
if (OB_FAIL(ObSQLUtils::convert_sql_text_from_schema_for_resolve(
|
||||
allocator_, dtc_params, body))) {
|
||||
LOG_WARN("fail to do charset convert", K(ret), K(body));
|
||||
@ -565,7 +565,7 @@ int ObPLCompiler::analyze_package(const ObString &source,
|
||||
CK (!source.empty());
|
||||
CK (package_ast.is_inited());
|
||||
if (OB_SUCC(ret)) {
|
||||
ObPLParser parser(allocator_, session_info_.get_local_collation_connection());
|
||||
ObPLParser parser(allocator_, session_info_.get_local_collation_connection(), session_info_.get_sql_mode());
|
||||
ObStmtNodeTree *parse_tree = NULL;
|
||||
CHECK_COMPATIBILITY_MODE(&session_info_);
|
||||
ObPLResolver resolver(allocator_,
|
||||
|
@ -7558,7 +7558,8 @@ int ObPLResolver::resolve_condition_compile(
|
||||
ObString old_sql;
|
||||
ObString new_sql;
|
||||
ObPLParser pl_parser(
|
||||
resolve_ctx_.allocator_, resolve_ctx_.session_info_.get_local_collation_connection());
|
||||
resolve_ctx_.allocator_, resolve_ctx_.session_info_.get_local_collation_connection(),
|
||||
resolve_ctx_.session_info_.get_sql_mode());
|
||||
ParseResult parse_result;
|
||||
|
||||
HEAP_VAR(ObPLFunctionAST, unit_ast, resolve_ctx_.allocator_) {
|
||||
@ -10754,7 +10755,7 @@ int ObPLResolver::resolve_package_accessible_by(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArenaAllocator allocator;
|
||||
ObPLParser parser(allocator, CS_TYPE_UTF8MB4_BIN);
|
||||
ObPLParser parser(allocator, CS_TYPE_UTF8MB4_BIN, resolve_ctx_.session_info_.get_sql_mode());
|
||||
ObStmtNodeTree *parse_tree = NULL;
|
||||
const ObStmtNodeTree *package_node = NULL;
|
||||
const ObStmtNodeTree *clause_node = NULL;
|
||||
@ -10800,7 +10801,7 @@ int ObPLResolver::resolve_routine_accessible_by(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObArenaAllocator allocator;
|
||||
ObPLParser parser(allocator, CS_TYPE_UTF8MB4_BIN);
|
||||
ObPLParser parser(allocator, CS_TYPE_UTF8MB4_BIN, resolve_ctx_.session_info_.get_sql_mode());
|
||||
ObStmtNodeTree *parse_tree = NULL;
|
||||
const ObStmtNodeTree *routine_node = NULL;
|
||||
const ObStmtNodeTree *clause_node = NULL;
|
||||
|
@ -204,7 +204,7 @@ int ObPLRouter::simple_resolve(ObPLFunctionAST &func_ast)
|
||||
ObStmtNodeTree *parse_tree = NULL;
|
||||
if (OB_SUCC(ret)) {
|
||||
ObString body = routine_info_.get_routine_body(); //获取body字符串
|
||||
ObPLParser parser(inner_allocator_, session_info_.get_local_collation_connection());
|
||||
ObPLParser parser(inner_allocator_, session_info_.get_local_collation_connection(), session_info_.get_sql_mode());
|
||||
CHECK_COMPATIBILITY_MODE(&session_info_);
|
||||
|
||||
if (OB_FAIL(ObSQLUtils::convert_sql_text_from_schema_for_resolve(
|
||||
|
@ -176,6 +176,7 @@ int ObPLParser::parse_procedure(const ObString &stmt_block,
|
||||
parse_ctx.is_not_utf8_connection_ = ObCharset::is_valid_collation(connection_collation_) ?
|
||||
(ObCharset::charset_type_by_coll(connection_collation_) != CHARSET_UTF8MB4) : false;
|
||||
parse_ctx.connection_collation_ = connection_collation_;
|
||||
parse_ctx.scanner_ctx_.sql_mode_ = sql_mode_;
|
||||
|
||||
ret = parse_stmt_block(parse_ctx, multi_stmt);
|
||||
if (OB_ERR_PARSE_SQL == ret) {
|
||||
@ -242,6 +243,7 @@ int ObPLParser::parse_routine_body(const ObString &routine_body, ObStmtNodeTree
|
||||
parse_ctx.is_not_utf8_connection_ = ObCharset::is_valid_collation(connection_collation_) ?
|
||||
(ObCharset::charset_type_by_coll(connection_collation_) != CHARSET_UTF8MB4) : false;
|
||||
parse_ctx.connection_collation_ = connection_collation_;
|
||||
parse_ctx.scanner_ctx_.sql_mode_ = sql_mode_;
|
||||
|
||||
if (OB_FAIL(parse_stmt_block(parse_ctx, routine_stmt))) {
|
||||
LOG_WARN("failed to parse stmt block", K(ret));
|
||||
@ -275,6 +277,7 @@ int ObPLParser::parse_package(const ObString &package,
|
||||
parse_ctx.is_not_utf8_connection_ = ObCharset::is_valid_collation(connection_collation_) ?
|
||||
(ObCharset::charset_type_by_coll(connection_collation_) != CHARSET_UTF8MB4) : false;
|
||||
parse_ctx.connection_collation_ = connection_collation_;
|
||||
parse_ctx.scanner_ctx_.sql_mode_ = sql_mode_;
|
||||
|
||||
if (OB_FAIL(parse_stmt_block(parse_ctx, package_stmt))) {
|
||||
LOG_WARN("failed to parse stmt block", K(ret));
|
||||
@ -310,6 +313,7 @@ int ObPLParser::parse_stmt_block(ObParseCtx &parse_ctx, ObStmtNodeTree *&multi_s
|
||||
pre_parse_ctx.is_for_trigger_ = parse_ctx.is_for_trigger_;
|
||||
pre_parse_ctx.is_for_preprocess_ = true;
|
||||
pre_parse_ctx.connection_collation_ = parse_ctx.connection_collation_;
|
||||
pre_parse_ctx.scanner_ctx_.sql_mode_ = parse_ctx.scanner_ctx_.sql_mode_;
|
||||
if (0 != obpl_parser_init(&pre_parse_ctx)) {
|
||||
ret = OB_ERR_PARSER_INIT;
|
||||
LOG_WARN("failed to initialized parser", K(ret));
|
||||
|
@ -34,9 +34,10 @@ namespace pl
|
||||
class ObPLParser
|
||||
{
|
||||
public:
|
||||
ObPLParser(common::ObIAllocator &allocator, common::ObCollationType conn_collation)
|
||||
ObPLParser(common::ObIAllocator &allocator, common::ObCollationType conn_collation, ObSQLMode sql_mode = 0)
|
||||
: allocator_(allocator),
|
||||
connection_collation_(conn_collation)
|
||||
connection_collation_(conn_collation),
|
||||
sql_mode_(sql_mode)
|
||||
{}
|
||||
int fast_parse(const ObString &stmt_block,
|
||||
ParseResult &parse_result);
|
||||
@ -71,6 +72,7 @@ private:
|
||||
private:
|
||||
common::ObIAllocator &allocator_;
|
||||
common::ObCollationType connection_collation_;
|
||||
ObSQLMode sql_mode_;
|
||||
};
|
||||
} // namespace pl
|
||||
} // namespace oceanbase
|
||||
|
@ -32,6 +32,8 @@ extern void obpl_mysql_parse_fatal_error(int32_t errcode, yyscan_t yyscanner, yy
|
||||
%x sq
|
||||
%x dq
|
||||
%x bt
|
||||
/* the adq is used to process dq in ANSI_QUOTES sql_mode*/
|
||||
%x adq
|
||||
|
||||
U [\x80-\xbf]
|
||||
U_2 [\xc2-\xdf]
|
||||
@ -241,13 +243,22 @@ NULL {
|
||||
}
|
||||
|
||||
{dqbegin} {
|
||||
BEGIN(dq);
|
||||
check_ptr(yylval);
|
||||
ObParseCtx *parse_ctx = (ObParseCtx *)yyextra;
|
||||
ObScannerCtx *scanner_ctx = &(parse_ctx->scanner_ctx_);
|
||||
scanner_ctx->first_column_ = yylloc->first_column;
|
||||
prepare_literal_buffer(scanner_ctx, parse_ctx->stmt_len_ + 1, parse_ctx->mem_pool_);
|
||||
malloc_new_node(yylval->node, parse_ctx->mem_pool_, T_VARCHAR, 0);
|
||||
yylval->node->str_len_ = 0;
|
||||
bool is_ansi_quotes = false;
|
||||
IS_ANSI_QUOTES(scanner_ctx->sql_mode_, is_ansi_quotes);
|
||||
if (is_ansi_quotes) {
|
||||
BEGIN(adq);
|
||||
malloc_new_node(yylval->node, parse_ctx->mem_pool_, T_IDENT, 0);
|
||||
yylval->node->str_len_ = 0;
|
||||
} else {
|
||||
BEGIN(dq);
|
||||
malloc_new_node(yylval->node, parse_ctx->mem_pool_, T_VARCHAR, 0);
|
||||
yylval->node->str_len_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
<dq>{dqend} {
|
||||
@ -319,6 +330,51 @@ NULL {
|
||||
return END_P;
|
||||
}
|
||||
|
||||
<adq>{dqend} {
|
||||
BEGIN(INITIAL);
|
||||
check_ptr(yylval);
|
||||
ObParseCtx *parse_ctx = (ObParseCtx *)yyextra;
|
||||
ObScannerCtx *scanner_ctx = &(parse_ctx->scanner_ctx_);
|
||||
char *tmp_literal = scanner_ctx->tmp_literal_;
|
||||
yylloc->first_column = scanner_ctx->first_column_;
|
||||
tmp_literal[yylval->node->str_len_] = '\0';
|
||||
|
||||
char *dup_value = NULL;
|
||||
if (parse_ctx->is_not_utf8_connection_) {
|
||||
dup_value = parse_str_convert_utf8(parse_ctx->charset_info_, tmp_literal,
|
||||
parse_ctx->mem_pool_, &(yylval->node->str_len_),
|
||||
&(parse_ctx->global_errno_));
|
||||
check_identifier_convert_result(parse_ctx->global_errno_);
|
||||
} else {
|
||||
dup_value = parse_strndup(tmp_literal, yylval->node->str_len_ + 1, parse_ctx->mem_pool_);
|
||||
}
|
||||
check_ptr(dup_value);
|
||||
yylval->node->str_value_ = dup_value;
|
||||
return IDENT;
|
||||
}
|
||||
|
||||
<adq>{dqdouble} {
|
||||
check_ptr(yylval);
|
||||
ObParseCtx *parse_ctx = (ObParseCtx *)yyextra;
|
||||
ObScannerCtx *scanner_ctx = &(parse_ctx->scanner_ctx_);
|
||||
char *tmp_literal = scanner_ctx->tmp_literal_;
|
||||
tmp_literal[yylval->node->str_len_++] = '"';
|
||||
}
|
||||
|
||||
<adq>{dqcontent} {
|
||||
check_ptr(yylval);
|
||||
ObParseCtx *parse_ctx = (ObParseCtx *)yyextra;
|
||||
ObScannerCtx *scanner_ctx = &(parse_ctx->scanner_ctx_);
|
||||
char *tmp_literal = scanner_ctx->tmp_literal_;
|
||||
memmove(tmp_literal + yylval->node->str_len_, yytext, yyleng);
|
||||
yylval->node->str_len_ += yyleng;
|
||||
}
|
||||
|
||||
<adq><<EOF>> {
|
||||
obpl_mysql_yyerror(yylloc, yyextra, "unterminated doublequoted string\n");
|
||||
return END_P;
|
||||
}
|
||||
|
||||
X'([0-9A-F])*'|0X([0-9A-F])+ {
|
||||
char *src = yytext + 2;
|
||||
size_t len = yyleng - 2;
|
||||
|
@ -126,6 +126,7 @@ int obpl_mysql_wrap_node_into_subquery(ObParseCtx *_parse_ctx, ParseNode *node)
|
||||
parse_result.charset_info_ = _parse_ctx->charset_info_;
|
||||
parse_result.is_not_utf8_connection_ = _parse_ctx->is_not_utf8_connection_;
|
||||
parse_result.connection_collation_ = _parse_ctx->connection_collation_;
|
||||
parse_result.sql_mode_ = _parse_ctx->scanner_ctx_.sql_mode_;
|
||||
if (0 == parse_sql_stmt(&parse_result)) {
|
||||
*node = *parse_result.result_tree_->children_[0];
|
||||
node->str_value_ = subquery;
|
||||
@ -2477,6 +2478,7 @@ ParseNode *obpl_mysql_read_sql_construct(ObParseCtx *parse_ctx, const char *pref
|
||||
parse_result.charset_info_ = parse_ctx->charset_info_;
|
||||
parse_result.is_not_utf8_connection_ = parse_ctx->is_not_utf8_connection_;
|
||||
parse_result.connection_collation_ = parse_ctx->connection_collation_;
|
||||
parse_result.sql_mode_ = parse_ctx->scanner_ctx_.sql_mode_;
|
||||
}
|
||||
if (sql_str_len <= 0) {
|
||||
//do nothing
|
||||
|
@ -233,7 +233,7 @@ int ObDbmsStats::gather_schema_stats(ObExecContext &ctx, ParamStore ¶ms, ObO
|
||||
&running_monitor))) {
|
||||
LOG_WARN("failed to update stat cache", K(ret));
|
||||
} else if (is_virtual_table(stat_param.table_id_)) {//not gather virtual table index.
|
||||
tmp_alloc.reset();
|
||||
//do nothing
|
||||
} else if (stat_param.cascade_ &&
|
||||
OB_FAIL(fast_gather_index_stats(ctx, stat_param,
|
||||
is_all_fast_gather, no_gather_index_ids))) {
|
||||
|
@ -272,6 +272,9 @@ bool ObDbmsStatsUtils::is_no_stat_virtual_table(const int64_t table_id)
|
||||
table_id == share::OB_ALL_VIRTUAL_SESSION_EVENT_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_PROXY_ROUTINE_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_TX_DATA_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_TRANS_LOCK_STAT_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_TRANS_SCHEDULER_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_SQL_AUDIT_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_SESSTAT_ORA_TID ||
|
||||
table_id == share::OB_TENANT_VIRTUAL_SHOW_CREATE_TABLE_ORA_TID ||
|
||||
table_id == share::OB_TENANT_VIRTUAL_SHOW_CREATE_PROCEDURE_ORA_TID ||
|
||||
@ -289,7 +292,9 @@ bool ObDbmsStatsUtils::is_no_stat_virtual_table(const int64_t table_id)
|
||||
table_id == share::OB_ALL_VIRTUAL_TRACE_SPAN_INFO_ORA_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_LOCK_WAIT_STAT_ORA_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_TRANS_STAT_ORA_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_OPT_STAT_GATHER_MONITOR_ORA_TID;
|
||||
table_id == share::OB_ALL_VIRTUAL_OPT_STAT_GATHER_MONITOR_ORA_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_TRANS_LOCK_STAT_ORA_TID ||
|
||||
table_id == share::OB_ALL_VIRTUAL_TRANS_SCHEDULER_ORA_TID;
|
||||
}
|
||||
|
||||
bool ObDbmsStatsUtils::is_virtual_index_table(const int64_t table_id)
|
||||
|
@ -1009,7 +1009,7 @@ int ObParser::parse(const ObString &query,
|
||||
}
|
||||
}
|
||||
|
||||
const ObString stmt(len, query.ptr());
|
||||
ObString stmt(len, query.ptr());
|
||||
memset(&parse_result, 0, sizeof(ParseResult));
|
||||
parse_result.is_multi_values_parser_ = (INS_MULTI_VALUES == parse_mode);
|
||||
parse_result.is_fp_ = (FP_MODE == parse_mode
|
||||
@ -1057,7 +1057,7 @@ int ObParser::parse(const ObString &query,
|
||||
}
|
||||
}
|
||||
|
||||
if (parse_result.is_fp_ || parse_result.is_dynamic_sql_) {
|
||||
if (OB_SUCC(ret) && (parse_result.is_fp_ || parse_result.is_dynamic_sql_)) {
|
||||
int64_t new_length = parse_result.is_fp_ ? stmt.length() + 1 : stmt.length() * 2;
|
||||
char *buf = (char *)parse_malloc(new_length, parse_result.malloc_pool_);
|
||||
if (OB_UNLIKELY(NULL == buf)) {
|
||||
@ -1068,6 +1068,18 @@ int ObParser::parse(const ObString &query,
|
||||
parse_result.no_param_sql_buf_len_ = new_length;
|
||||
}
|
||||
}
|
||||
//compatible mysql, mysql allow use the "--"
|
||||
if (OB_SUCC(ret) && lib::is_mysql_mode() && stmt.case_compare("--") == 0) {
|
||||
const char *line_str = "-- ";
|
||||
char *buf = (char *)parse_malloc(strlen(line_str), parse_result.malloc_pool_);
|
||||
if (OB_UNLIKELY(NULL == buf)) {
|
||||
ret = OB_ALLOCATE_MEMORY_FAILED;
|
||||
LOG_ERROR("no memory for parser");
|
||||
} else {
|
||||
MEMCPY(buf, line_str, strlen(line_str));
|
||||
stmt.assign_ptr(buf, strlen(line_str));
|
||||
}
|
||||
}
|
||||
if (OB_SUCC(ret) && OB_ISNULL(parse_result.charset_info_)) {
|
||||
ret = OB_ERR_UNEXPECTED;
|
||||
LOG_WARN("charset info is null", K(ret),
|
||||
@ -1107,7 +1119,7 @@ int ObParser::parse(const ObString &query,
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ObPLParser pl_parser(*(ObIAllocator*)(parse_result.malloc_pool_), connection_collation_);
|
||||
ObPLParser pl_parser(*(ObIAllocator*)(parse_result.malloc_pool_), connection_collation_, sql_mode_);
|
||||
if (OB_FAIL(pl_parser.parse(stmt, stmt, parse_result, is_pl_inner_parse))) {
|
||||
LOG_WARN("failed to parse stmt as pl", K(stmt), K(ret));
|
||||
// may create ddl func, try it.
|
||||
|
@ -299,8 +299,12 @@ int add_alias_name(ParseNode *node, ParseResult *result, int end)
|
||||
if (OB_UNLIKELY(NULL == trans_buf)) {
|
||||
ret = OB_PARSER_ERR_NO_MEMORY;
|
||||
} else {
|
||||
bool is_ansi_quotes = false;
|
||||
IS_ANSI_QUOTES(result->sql_mode_, is_ansi_quotes);
|
||||
for (; index1 < node->str_len_; index1++) {
|
||||
if ('\"' == node->str_value_[index1] && !(index1 > 0 && '\\' == node->str_value_[index1 - 1])) {
|
||||
if (is_ansi_quotes && '\"' == node->str_value_[index1]) {
|
||||
//do nothing, in mysql ansi quotes sql mode: " <==> `, just skip
|
||||
} else if ('\"' == node->str_value_[index1] && !(index1 > 0 && '\\' == node->str_value_[index1 - 1])) {
|
||||
trans_buf[index2++] = '\\';
|
||||
trans_buf[index2++] = '\"';
|
||||
} else {
|
||||
|
@ -1049,4 +1049,20 @@ do {\
|
||||
}\
|
||||
} while(0);\
|
||||
|
||||
// bugfix:
|
||||
// avoid '"' in the middle of a str in oracle mode
|
||||
#define CHECK_ORACLE_IDENTIFIER_VALID(src_str, str_len) \
|
||||
do { \
|
||||
if (OB_UNLIKELY(src_str == NULL || str_len <= 0)) { \
|
||||
} else { \
|
||||
for (int64_t i = 0; i < str_len; i++) { \
|
||||
if (OB_UNLIKELY(src_str[i] == '\"')) { \
|
||||
((ParseResult *)yyextra)->extra_errno_ = OB_PARSER_ERR_UNSUPPORTED; \
|
||||
yyerror(yylloc, yyextra, "identifier not support to have double quote");\
|
||||
return ERROR; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} while(0); \
|
||||
|
||||
#endif /* OCEANBASE_SRC_SQL_PARSER_SQL_PARSER_BASE_H_ */
|
||||
|
@ -64,7 +64,7 @@ c_cmt_end \*+\/
|
||||
comment ({sql_comment})
|
||||
identifier (([A-Za-z0-9$_]|{UTF8_GB_CHAR})*)
|
||||
system_variable (@@[A-Za-z_][A-Za-z0-9_]*)|(@@[`][`A-Za-z_][`A-Za-z_]*)
|
||||
user_variable (@[A-Za-z0-9_\.$]*)|(@[`'\"][`'\"A-Za-z0-9_\.$/%]*)
|
||||
user_variable (@[A-Za-z0-9_\.$]*)|(@[`'\"][`'\"A-Za-z0-9_\.$/%@#\-!,;&~\:\?\+\|\^\*\{\}\(\)\[\]]*)
|
||||
version_num ([0-9]+\.+[0-9]*)
|
||||
int_num [0-9]+
|
||||
client_version \([0-9]+(\.[0-9]+)*\)
|
||||
|
@ -293,7 +293,7 @@ int ObAlterRoutineResolver::parse_routine(
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
ObDataTypeCastParams dtc_params = session_info_->get_dtc_params();
|
||||
pl::ObPLParser parser(*(params_.allocator_), dtc_params.connection_collation_);
|
||||
pl::ObPLParser parser(*(params_.allocator_), dtc_params.connection_collation_, session_info_->get_sql_mode());
|
||||
ParseResult parse_result;
|
||||
ObString body = source;
|
||||
MEMSET(&parse_result, 0, SIZEOF(ParseResult));
|
||||
|
@ -473,7 +473,7 @@ int ObTriggerResolver::resolve_timing_point(int16_t before_or_after, int16_t stm
|
||||
ObCreateTriggerArg &trigger_arg)
|
||||
{
|
||||
int ret = OB_SUCCESS;
|
||||
pl::ObPLParser pl_parser(*allocator_, session_info_->get_local_collation_connection());
|
||||
pl::ObPLParser pl_parser(*allocator_, session_info_->get_local_collation_connection(), session_info_->get_sql_mode());
|
||||
ParseResult parse_result;
|
||||
const ObStmtNodeTree *parse_tree = NULL;
|
||||
bool is_include_old_new_in_trigger = false;
|
||||
@ -759,7 +759,7 @@ int ObTriggerResolver::resolve_trigger_body(const ParseNode &parse_node,
|
||||
session_info_->get_dtc_params()));
|
||||
if (OB_SUCC(ret) && lib::is_mysql_mode()) {
|
||||
ObString procedure_source;
|
||||
pl::ObPLParser parser(*allocator_, session_info_->get_local_collation_connection());
|
||||
pl::ObPLParser parser(*allocator_, session_info_->get_local_collation_connection(), session_info_->get_sql_mode());
|
||||
ObStmtNodeTree *parse_tree = NULL;
|
||||
CHECK_COMPATIBILITY_MODE(session_info_);
|
||||
OZ (trigger_info.gen_procedure_source(trigger_arg.base_object_database_,
|
||||
@ -1068,7 +1068,7 @@ int ObTriggerResolver::analyze_trigger(ObSchemaGetterGuard &schema_guard,
|
||||
ObPLCompiler compiler(allocator, *session_info, schema_guard, package_guard, *sql_proxy);
|
||||
const ObPackageInfo &package_spec_info = trigger_info.get_package_spec_info();
|
||||
if (!trigger_info.get_update_columns().empty()) {
|
||||
ObPLParser parser(allocator, session_info->get_local_collation_connection());
|
||||
ObPLParser parser(allocator, session_info->get_local_collation_connection(), session_info->get_sql_mode());
|
||||
ObStmtNodeTree *column_list = NULL;
|
||||
ParseResult parse_result;
|
||||
OZ (parser.parse(trigger_info.get_update_columns(), trigger_info.get_update_columns(), parse_result, true));
|
||||
|
@ -1946,6 +1946,8 @@ test bug2267_4 PROCEDURE 'admin'@'%' 0000-00-00 00:00:00 0000-00-00 00:00:00 DEF
|
||||
call bug2267_2()|
|
||||
Db Name Type Definer Modified Created Security_type Comment character_set_client collation_connection Database Collation
|
||||
test bug2267_4 FUNCTION 'admin'@'%' 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER NULL utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
test bug2564_3 FUNCTION 'admin'@'%' 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER NULL utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
test bug2564_4 FUNCTION 'admin'@'%' 0000-00-00 00:00:00 0000-00-00 00:00:00 DEFINER NULL utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
call bug2267_3()|
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
bug2267_1 CREATE DEFINER = admin@% PROCEDURE `test`.`bug2267_1`
|
||||
@ -2228,7 +2230,6 @@ set @@sql_mode = 'ANSI_QUOTES'|
|
||||
drop procedure if exists bug2564_2|
|
||||
create procedure bug2564_2()
|
||||
insert into "t1" values ('foo', 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 'insert into "t1" values ('foo', 1)' at line 2
|
||||
set @@sql_mode = ''$
|
||||
drop function if exists bug2564_3$
|
||||
create function bug2564_3(x int, y int) returns int
|
||||
@ -2247,7 +2248,11 @@ MODIFIES SQL DATA
|
||||
COMMENT `Joe's procedure`
|
||||
insert into `t1` values ("foo", 1) utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
show create procedure bug2564_2|
|
||||
ERROR 42000: procedure/function does not exist
|
||||
Procedure sql_mode Create Procedure character_set_client collation_connection Database Collation
|
||||
bug2564_2 ANSI_QUOTES CREATE DEFINER = admin@% PROCEDURE `test`.`bug2564_2`
|
||||
()
|
||||
|
||||
MODIFIES SQL DATA insert into "t1" values ('foo', 1) utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
show create function bug2564_3|
|
||||
Function sql_mode Create Function character_set_client collation_connection Database Collation
|
||||
bug2564_3 CREATE DEFINER = admin@% FUNCTION `test`.`bug2564_3`
|
||||
@ -2262,7 +2267,6 @@ bug2564_4 REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ANSI CREATE DEF
|
||||
) RETURNS int(11) return x || y utf8mb4 utf8mb4_general_ci utf8mb4_general_ci
|
||||
drop procedure bug2564_1|
|
||||
drop procedure bug2564_2|
|
||||
ERROR 42000: PROCEDURE test.bug2564_2 does not exist
|
||||
drop function bug2564_3|
|
||||
drop function bug2564_4|
|
||||
drop function if exists bug3132|
|
||||
|
@ -2595,7 +2595,6 @@ create procedure bug2564_1()
|
||||
set @@sql_mode = 'ANSI_QUOTES'|
|
||||
--disable_warnings ONCE
|
||||
drop procedure if exists bug2564_2|
|
||||
--error 1064
|
||||
create procedure bug2564_2()
|
||||
insert into "t1" values ('foo', 1)|
|
||||
|
||||
@ -2616,14 +2615,12 @@ delimiter |$
|
||||
set @@sql_mode = ''|
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create procedure bug2564_1|
|
||||
--error 1305
|
||||
show create procedure bug2564_2|
|
||||
show create function bug2564_3|
|
||||
--source mysql_test/include/show_create_table_old_version_replica2.inc
|
||||
show create function bug2564_4|
|
||||
|
||||
drop procedure bug2564_1|
|
||||
--error 1305
|
||||
drop procedure bug2564_2|
|
||||
drop function bug2564_3|
|
||||
drop function bug2564_4|
|
||||
|
Loading…
x
Reference in New Issue
Block a user