Commit c33f7f9f authored by unknown's avatar unknown

Fix crash in 'INSERT DELAYED' statement that failed due to a

conflict in a unique key. (Bug #12226)


mysql-test/r/delayed.result:
  Add results
mysql-test/t/delayed.test:
  Add new regression test
sql/sql_insert.cc:
  Fix crash in error handling of 'INSERT DELAYED' statement
parent e53419b4
...@@ -32,3 +32,10 @@ a b ...@@ -32,3 +32,10 @@ a b
3 d 3 d
4 e 4 e
drop table t1; drop table t1;
create table t1 (a int not null primary key);
insert into t1 values (1);
insert delayed into t1 values (1);
select * from t1;
a
1
drop table t1;
...@@ -38,3 +38,12 @@ select * from t1; ...@@ -38,3 +38,12 @@ select * from t1;
drop table t1; drop table t1;
# End of 4.1 tests # End of 4.1 tests
#
# Bug #12226: Crash when a delayed insert fails due to a duplicate key
#
create table t1 (a int not null primary key);
insert into t1 values (1);
insert delayed into t1 values (1);
select * from t1;
drop table t1;
...@@ -1088,7 +1088,9 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) ...@@ -1088,7 +1088,9 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info)
err: err:
info->last_errno= error; info->last_errno= error;
thd->lex->current_select->no_error= 0; // Give error /* current_select is NULL if this is a delayed insert */
if (thd->lex->current_select)
thd->lex->current_select->no_error= 0; // Give error
table->file->print_error(error,MYF(0)); table->file->print_error(error,MYF(0));
before_trg_err: before_trg_err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment