* Alexander Nozdrin <alexander.nozdrin@stripped> [10/10/18 10:13]:
> 3247 Alexander Nozdrin 2010-10-18
> Patch for Bug#55850 (Trigger warnings not cleared).
> + @param thd Thread context.
> + @param merge_warnings_to_caller Flag specifying if Warning Info should be
> + propagated to the caller or not.
Suggest to rename merge_da_on_success, as discussed on the phone.
> bool
> -sp_head::execute(THD *thd)
> +sp_head::execute(THD *thd, bool merge_warnings_to_caller)
> {
> DBUG_ENTER("sp_head::execute");
> char saved_cur_db_name_buf[NAME_LEN+1];
> @@ -1484,8 +1490,15 @@ sp_head::execute(THD *thd)
> thd->stmt_arena= old_arena;
> state= EXECUTED;
>
> - /* Restore the caller's original warning information area. */
> - saved_warning_info->merge_with_routine_info(thd, thd->warning_info);
> + /*
> + Restore the caller's original warning information area:
> + - warnings generated during trigger execution should not be
> + propagated to the caller on success;
> + - if there was an exception during execution, warning info should be
> + propagated to the caller in any case.
> + */
> + if (err_status || merge_warnings_to_caller)
> + saved_warning_info->merge_with_routine_info(thd, thd->warning_info);
OK to push.
--