Fix ps prepare stage error 4016

This commit is contained in:
obdev
2023-07-27 10:42:29 +00:00
committed by ob-robot
parent 9ed642a58f
commit 553f5616ad
4 changed files with 7 additions and 9 deletions

View File

@ -153,8 +153,8 @@ int ObExprJsonObject::calc_result_typeN(ObExprResType& type,
ObExecContext* ctx = nullptr; ObExecContext* ctx = nullptr;
bool is_deduce_input = true; bool is_deduce_input = true;
if (OB_NOT_NULL(session) && OB_NOT_NULL(ctx = session->get_cur_exec_ctx())) { if (OB_NOT_NULL(session)) {
is_deduce_input = (!ctx->is_ps_prepare_stage()); is_deduce_input = (!session->is_varparams_sql_prepare());
} }
for (int64_t i = 0; OB_SUCC(ret) && is_deduce_input && i < param_num; i += 2) { for (int64_t i = 0; OB_SUCC(ret) && is_deduce_input && i < param_num; i += 2) {

View File

@ -75,7 +75,7 @@ int ObExprLeft::calc_result_type2(ObExprResType &type,
} else if (OB_ISNULL(exec_ctx = session->get_cur_exec_ctx())) { } else if (OB_ISNULL(exec_ctx = session->get_cur_exec_ctx())) {
ret = OB_ERR_UNEXPECTED; ret = OB_ERR_UNEXPECTED;
LOG_WARN("exec context is NULL", K(ret)); LOG_WARN("exec context is NULL", K(ret));
} else if (exec_ctx->is_ps_prepare_stage()) { } else if (session->is_varparams_sql_prepare()) {
// the ps prepare stage does not do type deduction, and directly gives a default type. // the ps prepare stage does not do type deduction, and directly gives a default type.
type.set_char(); type.set_char();
type.set_default_collation_type(); type.set_default_collation_type();

View File

@ -41,7 +41,7 @@ int ObExprOracleNullif::calc_result_type2(ObExprResType &type,
//Oracle 不支持lob类型的 nullif比较 //Oracle 不支持lob类型的 nullif比较
exec_ctx = session->get_cur_exec_ctx(); exec_ctx = session->get_cur_exec_ctx();
if (type1.is_null() || type1.is_lob()) { if (type1.is_null() || type1.is_lob()) {
if (OB_NOT_NULL(exec_ctx) && exec_ctx->is_ps_prepare_stage()) { if (session->is_varparams_sql_prepare()) {
type.set_null(); type.set_null();
} else { } else {
if (is_called_in_sql()) { if (is_called_in_sql()) {

View File

@ -1082,12 +1082,10 @@ int ObSql::do_real_prepare(const ObString &sql,
parse_result.result_tree_, parse_result.result_tree_,
param_store, param_store,
session.get_local_collation_connection()))) { session.get_local_collation_connection()))) {
LOG_WARN("parameterize syntax tree failed", K(ret)); LOG_INFO("parameterize syntax tree failed", K(ret));
if (OB_INVALID_ARGUMENT == ret || OB_NOT_SUPPORTED == ret) {
pc_ctx.ps_need_parameterized_ = false; pc_ctx.ps_need_parameterized_ = false;
ret = OB_SUCCESS; ret = OB_SUCCESS;
} }
}
if (OB_SUCC(ret)) { if (OB_SUCC(ret)) {
if (!pc_ctx.ps_need_parameterized_) { if (!pc_ctx.ps_need_parameterized_) {
pc_ctx.fixed_param_idx_.reset(); pc_ctx.fixed_param_idx_.reset();