Commit 5ae25ea5 authored by aivanov@mysql.com's avatar aivanov@mysql.com

Fixed BUG#13683: INSERT DELAYED into a view creates an infinite loop.

 The bug was caused by wrong behaviour of mysql_insert() which in case
 of INSERT DELAYED into a view exited with thd->net.report_error == 0.
 This blocked error reporting to the client which started waiting
 infinitely for response to the query.
parent 63f58202
...@@ -299,3 +299,9 @@ select count(*) from t2; ...@@ -299,3 +299,9 @@ select count(*) from t2;
count(*) count(*)
25500 25500
drop table t1,t2,t3; drop table t1,t2,t3;
create table t1 (n int);
create view v1 as select * from t1;
insert delayed into v1 values (1);
ERROR HY000: 'test.v1' is not BASE TABLE
drop table t1;
drop view v1;
...@@ -175,3 +175,15 @@ select count(*) from t2; ...@@ -175,3 +175,15 @@ select count(*) from t2;
insert into t2 select t1.* from t1, t2 t, t3 where t1.id1 = t.id2 and t.id2 = t3.id3; insert into t2 select t1.* from t1, t2 t, t3 where t1.id1 = t.id2 and t.id2 = t3.id3;
select count(*) from t2; select count(*) from t2;
drop table t1,t2,t3; drop table t1,t2,t3;
#
# Test for INSERT DELAYED INTO a <view>
# BUG#13683: INSERT DELAYED into a view creates an infinite loop
#
create table t1 (n int);
create view v1 as select * from t1;
--error 1347
insert delayed into v1 values (1);
drop table t1;
drop view v1;
...@@ -321,7 +321,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list, ...@@ -321,7 +321,7 @@ bool mysql_insert(THD *thd,TABLE_LIST *table_list,
if (!table_list->derived && !table_list->view) if (!table_list->derived && !table_list->view)
table_list->updatable= 1; // usual table table_list->updatable= 1; // usual table
} }
else else if (thd->net.last_errno != ER_WRONG_OBJECT)
{ {
/* Too many delayed insert threads; Use a normal insert */ /* Too many delayed insert threads; Use a normal insert */
table_list->lock_type= lock_type= TL_WRITE; table_list->lock_type= lock_type= TL_WRITE;
......
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