diff options
-rw-r--r-- | Docs/manual.texi | 5 | ||||
-rw-r--r-- | mysql-test/r/multi_update.result | 16 | ||||
-rw-r--r-- | mysql-test/t/multi_update.test | 10 | ||||
-rw-r--r-- | sql/sql_delete.cc | 2 | ||||
-rw-r--r-- | sql/sql_update.cc | 2 |
5 files changed, 32 insertions, 3 deletions
diff --git a/Docs/manual.texi b/Docs/manual.texi index b8ff8efaf68..45807e95371 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -50797,6 +50797,11 @@ each individual 4.0.x release. @appendixsubsec Changes in release 4.0.5 @itemize @item +Fixed a bug in multi-table deletes when outer join is used on an empty +table, which get's first to be deleted +@item +Fixed a bug in multi-table updates when a single table is updated +@item Updated source tree to be built using @code{automake 1.5} and @code{libtool 1.4}. @item diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 328eb9b394e..9dff4fba825 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -135,3 +135,19 @@ ID ParId tst tst1 2 2 MSSQL Microsoft 3 3 ORACLE ORACLE drop table parent, child; +drop table if exists t1, t2 ; +create table t1 (n numeric(10)); +create table t2 (n numeric(10)); +insert into t2 values (1),(2),(4),(8),(16),(32); +select * from t2 left outer join t1 using (n); +n n +1 NULL +2 NULL +4 NULL +8 NULL +16 NULL +32 NULL +delete t1,t2 from t2 left outer join t1 using (n); +select * from t2 left outer join t1 using (n); +n n +drop table if exists t1,t2 ; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 205dbb10ccf..7d855dd54ea 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -139,4 +139,12 @@ WHERE child.ParId = parent.Id; select * from child; -drop table parent, child;
\ No newline at end of file +drop table parent, child; +drop table if exists t1, t2 ; +create table t1 (n numeric(10)); +create table t2 (n numeric(10)); +insert into t2 values (1),(2),(4),(8),(16),(32); +select * from t2 left outer join t1 using (n); +delete t1,t2 from t2 left outer join t1 using (n); +select * from t2 left outer join t1 using (n); +drop table if exists t1,t2 ; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index eaa8c6c2a67..b40e0b7b093 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -329,7 +329,7 @@ bool multi_delete::send_data(List<Item> &values) table->status|= STATUS_DELETED; if (!(error=table->file->delete_row(table->record[0]))) deleted++; - else + else if (!table_being_deleted->next) { table->file->print_error(error,MYF(0)); DBUG_RETURN(1); diff --git a/sql/sql_update.cc b/sql/sql_update.cc index b5df0e03823..4af5777a53f 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -768,7 +768,7 @@ bool multi_update::send_eof() thd->proc_info="updating the reference tables"; /* Does updates for the last n - 1 tables, returns 0 if ok */ - int error = do_updates(false); /* do_updates returns 0 if success */ + int error = (num_updated > 1) ? do_updates(false) : 0; /* do_updates returns 0 if success */ /* reset used flags */ #ifndef NOT_USED |