Fix some query rewrite bug

This commit is contained in:
obdev
2023-01-04 08:08:15 +00:00
committed by ob-robot
parent 0bd1b2cf37
commit 4453ef5eee
7 changed files with 385 additions and 3 deletions

View File

@ -1921,7 +1921,7 @@ OB_INLINE int ObSql::handle_text_query(const ObString &stmt, ObSqlCtx &context,
// if get plan from plan cache, reset its auto-increment variable here
// do not set variable for hidden primary key; its default value is 1
if (OB_SUCC(ret)) {
if (!context.is_prepare_protocol_
if (!context.is_text_ps_mode_
&& OB_FAIL(after_get_plan(*pc_ctx, session, result.get_physical_plan(),
result.get_is_from_plan_cache(), NULL))) {
LOG_WARN("fail to handle after get plan", K(ret));
@ -4264,6 +4264,7 @@ int ObSql::handle_text_execute(const ObStmt *basic_stmt,
{
int ret = OB_SUCCESS;
const ObExecuteStmt *exec_stmt = static_cast<const ObExecuteStmt*>(basic_stmt);
sql_ctx.is_text_ps_mode_ = true;
if (OB_ISNULL(exec_stmt)) {
ret = OB_INVALID_ARGUMENT;
LOG_WARN("stmt is NULL", K(ret), KPC(exec_stmt), KPC(basic_stmt));

View File

@ -233,6 +233,7 @@ ObSqlCtx::ObSqlCtx()
is_protocol_weak_read_(false),
flashback_query_expr_(nullptr),
is_execute_call_stmt_(false),
is_text_ps_mode_(false),
reroute_info_(nullptr)
{
sql_id_[0] = '\0';
@ -279,6 +280,7 @@ void ObSqlCtx::reset()
stmt_type_ = stmt::T_NONE;
cur_plan_ = nullptr;
is_execute_call_stmt_ = false;
is_text_ps_mode_ = false;
}
//release dynamic allocated memory
@ -292,6 +294,7 @@ void ObSqlCtx::clear()
multi_stmt_rowkey_pos_.reset();
spm_ctx_.bl_key_.reset();
cur_stmt_ = nullptr;
is_text_ps_mode_ = false;
}
OB_SERIALIZE_MEMBER(ObSqlCtx, stmt_type_);

View File

@ -500,6 +500,7 @@ public:
ObRawExpr *flashback_query_expr_;
ObSpmCacheCtx spm_ctx_;
bool is_execute_call_stmt_;
bool is_text_ps_mode_;
private:
share::ObFeedbackRerouteInfo *reroute_info_;
};

View File

@ -1348,7 +1348,6 @@ BEGIN(in_c_comment);
return QUESTIONMARK;
}
}
":"{identifier} {
ParseResult *p = (ParseResult *)yyextra;
check_value(yylval);
@ -1365,7 +1364,6 @@ BEGIN(in_c_comment);
if (OB_UNLIKELY(p->question_mark_ctx_.by_ordinal_)) {
YY_UNEXPECTED_ERROR("Ordinal binding and Named binding cannot be combined\n");
}
copy_and_replace_questionmark(p, yylloc->first_column, yylloc->last_column, yylval->node->value_);
if (IS_FAST_PARAMETERIZE) {
yylval->node->raw_text_ = parse_strdup(yytext, p->malloc_pool_, &(yylval->node->text_len_));
check_malloc(yylval->node->raw_text_);