* Jon Olav Hauglid <jon.hauglid@stripped> [10/07/21 15:14]:
> === modified file 'sql/sql_insert.cc'
> --- a/sql/sql_insert.cc 2010-07-08 21:20:08 +0000
> +++ b/sql/sql_insert.cc 2010-07-21 10:35:04 +0000
> @@ -3057,9 +3057,14 @@ select_insert::prepare(List<Item> &value
> we are fixing fields from insert list.
> */
> lex->current_select= &lex->select_lex;
> +
> + /* Errors during check_insert_fields() should not be ignored. */
> + bool no_error_save= lex->current_select->no_error;
> + lex->current_select->no_error= FALSE;
> res= (setup_fields(thd, 0, values, MARK_COLUMNS_READ, 0, 0) ||
> check_insert_fields(thd, table_list, *fields, values,
> !insert_into_view, 1, &map));
> + lex->current_select->no_error= no_error_save;
No need to restore the old value, we intend to terminate the
statement anyway.
>
>
> - if ((thd->variables.option_bits & OPTION_SAFE_UPDATES) &&
> error_if_full_join(join))
> - DBUG_RETURN(1);
> + if (thd->variables.option_bits & OPTION_SAFE_UPDATES)
> + {
> + /* This error should not be ignored. */
> + bool no_error_save= thd->lex->current_select->no_error;
> + thd->lex->current_select->no_error= FALSE;
> + bool error= error_if_full_join(join);
> + thd->lex->current_select->no_error= no_error_save;
> + if (error)
> + DBUG_RETURN(TRUE);
Better put no_error assingment right nto error_if_full_join, in
front of my_message(), and don't restore it.
> + }
> main_table=join->join_tab->table;
> table_to_update= 0;
The patch is OK to push after fixing these two bits.
Thank you for looking at it!
--