diff options
-rw-r--r-- | mysql-test/r/innodb.result | 12 | ||||
-rw-r--r-- | mysql-test/t/innodb.test | 14 | ||||
-rw-r--r-- | sql/sql_insert.cc | 4 |
3 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/r/innodb.result b/mysql-test/r/innodb.result index 69268f1d5c5..20cc50dcc61 100644 --- a/mysql-test/r/innodb.result +++ b/mysql-test/r/innodb.result @@ -1329,3 +1329,15 @@ id label 3524 Societe Test 3525 Fournisseur Test drop table t1,t2; +create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) type=innodb; +select * from t1; +c1 c2 stamp +replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12"); +ERROR HY000: Table storage engine for 't1' doesn't have this option +select * from t1; +c1 c2 stamp +replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" ); +ERROR HY000: Table storage engine for 't1' doesn't have this option +select * from t1; +c1 c2 stamp +drop table t1; diff --git a/mysql-test/t/innodb.test b/mysql-test/t/innodb.test index 635a15baa41..cd3a5693535 100644 --- a/mysql-test/t/innodb.test +++ b/mysql-test/t/innodb.test @@ -906,3 +906,17 @@ SELECT t2.id, t1.label FROM t2 INNER JOIN (SELECT t1.id_object as id_object FROM t1 WHERE t1.label LIKE '%test%') AS lbl ON (t2.id = lbl.id_object) INNER JOIN t1 ON (t2.id = t1.id_object); drop table t1,t2; + +# +# Bug #1078 +# +create table t1 (c1 char(5) unique not null, c2 int, stamp timestamp) type=innodb; +select * from t1; +--error 1031 +replace delayed into t1 (c1, c2) values ( "text1","11"),( "text2","12"); +select * from t1; +--error 1031 +replace delayed into t1 (c1, c2) values ( "text1","12"),( "text2","13"),( "text3","14", "a" ),( "text4","15", "b" ); +select * from t1; +drop table t1; + diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 947205949f1..6cc5d25c34e 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -172,7 +172,10 @@ int mysql_insert(THD *thd,TABLE_LIST *table_list, else res= (table == 0); else + { + lock_type=TL_WRITE; res= open_and_lock_tables(thd, table_list); + } } else res= open_and_lock_tables(thd, table_list); @@ -627,6 +630,7 @@ public: thd.current_tablenr=0; thd.version=refresh_version; thd.command=COM_DELAYED_INSERT; + thd.lex.current_select= 0; /* for my_message_sql */ bzero((char*) &thd.net,sizeof(thd.net)); // Safety thd.system_thread=1; |