Hi Martin,
On 4/21/09 5:45 AM, Martin Hansson wrote:
> #At file:///data0/martin/bzr/5.1bt-bug44306/ based on
> revid:satya.bn@stripped
>
> 2861 Martin Hansson 2009-04-21
> Bug#44306: Assertion fail on duplicate key error in
> 'INSERT ... SELECT' statements
>
[..]
> === modified file 'sql/sql_insert.cc'
> --- a/sql/sql_insert.cc 2009-04-08 23:58:57 +0000
> +++ b/sql/sql_insert.cc 2009-04-21 12:45:10 +0000
> @@ -3223,7 +3223,9 @@ bool select_insert::send_eof()
> (thd->arg_of_last_insert_id_function ?
> thd->first_successful_insert_id_in_prev_stmt :
> (info.copied ? autoinc_value_of_last_inserted_row : 0));
> - ::my_ok(thd, (ulong) thd->row_count_func, id, buff);
> + /* An error may have been set during execution of aggregate functions. */
> + if (!thd->main_da.is_error())
> + ::my_ok(thd, (ulong) thd->row_count_func, id, buff);
> DBUG_RETURN(0);
> }
It seems to me that the core problem is that the code in
return_zero_rows is ignoring the return from ::send_data and proceeds to
call ::send_eof pretending that the statement succeeded. What do you think?
Regards,
-- Davi Arnaut