[to #48107427]can not return a result set from a trigger

This commit is contained in:
seuwebber
2023-05-25 05:47:01 +00:00
committed by ob-robot
parent 16bf66295c
commit e4dfa520cf
2 changed files with 6 additions and 1 deletions

View File

@ -913,7 +913,7 @@ int ObPLContext::check_routine_legal(ObPLFunction &routine, bool in_function, bo
ret = OB_ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG;
LOG_WARN("Dynamic SQL is not allowed in stored function", K(ret));
LOG_USER_ERROR(OB_ER_STMT_NOT_ALLOWED_IN_SF_OR_TRG, "Dynamic SQL");
} else if (routine.get_multi_results() || in_tg) {
} else if (routine.get_multi_results()) {
ret = OB_ER_SP_NO_RETSET;
LOG_WARN("Not allowed to return a result set in pl function", K(ret));
if (in_tg) {

View File

@ -402,12 +402,17 @@ int TriggerHandle::calc_trigger_routine(
ObArray<int64_t> path;
ObArray<int64_t> nocopy_params;
trigger_id = ObTriggerInfo::get_trigger_spec_package_id(trigger_id);
bool old_flag = false;
CK (OB_NOT_NULL(exec_ctx.get_my_session()));
OX (old_flag = exec_ctx.get_my_session()->is_for_trigger_package());
OX (exec_ctx.get_my_session()->set_for_trigger_package(true));
OV (OB_NOT_NULL(exec_ctx.get_pl_engine()));
OZ (exec_ctx.get_pl_engine()->execute(
exec_ctx, exec_ctx.get_allocator(), trigger_id, routine_id, path, params, nocopy_params, result),
trigger_id, routine_id, params);
CK (OB_NOT_NULL(exec_ctx.get_my_session()));
OZ (exec_ctx.get_my_session()->reset_all_package_state_by_dbms_session(true));
OX (exec_ctx.get_my_session()->set_for_trigger_package(old_flag));
return ret;
}