From: Date: April 4 2006 11:09pm Subject: bk commit into 5.0 tree (aivanov:1.2100) BUG#13683 List-Archive: http://lists.mysql.com/commits/4452 X-Bug: 13683 Message-Id: Below is the list of changes that have just been committed into a local 5.0 repository of alexi. When alexi does a push these changes will be propagated to the main repository and, within 24 hours after the push, to the public repository. For information on how to access the public repository see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html ChangeSet 1.2100 06/04/05 01:09:07 aivanov@stripped +3 -0 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. sql/sql_insert.cc 1.185 06/04/05 01:09:02 aivanov@stripped +1 -1 Fixed BUG#13683: INSERT DELAYED into a view creates an infinite loop. Changed mysql_insert(): delayed_get_table() applied to a view exits with ER_WRONG_OBJECT error (and with thd->net.report_error == 1) and in this case we must just exit from mysql_insert(). Prior to this change, instead of exiting open_and_lock_tables() was invoked which cleared thd->net.report_error to zero and caused the bug. mysql-test/t/insert.test 1.22 06/04/05 01:09:02 aivanov@stripped +12 -0 Added test case. mysql-test/r/insert.result 1.23 06/04/05 01:09:02 aivanov@stripped +6 -0 Fixed results for the added test case. # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: aivanov # Host: mysqld.localdomain # Root: /home/alexi/bugs/mysql-5.0-13683 --- 1.184/sql/sql_insert.cc 2006-03-15 20:15:42 +03:00 +++ 1.185/sql/sql_insert.cc 2006-04-05 01:09:02 +04:00 @@ -321,7 +321,7 @@ if (!table_list->derived && !table_list->view) 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 */ table_list->lock_type= lock_type= TL_WRITE; --- 1.22/mysql-test/r/insert.result 2004-11-03 13:39:31 +03:00 +++ 1.23/mysql-test/r/insert.result 2006-04-05 01:09:02 +04:00 @@ -299,3 +299,9 @@ count(*) 25500 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; --- 1.21/mysql-test/t/insert.test 2006-02-01 13:36:27 +03:00 +++ 1.22/mysql-test/t/insert.test 2006-04-05 01:09:02 +04:00 @@ -175,3 +175,15 @@ insert into t2 select t1.* from t1, t2 t, t3 where t1.id1 = t.id2 and t.id2 = t3.id3; select count(*) from t2; drop table t1,t2,t3; + +# +# Test for INSERT DELAYED INTO a +# 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;