From 945c46e6d2b83a728a3decd90fc83c01e16ca2d8 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 4 Jun 2002 20:34:13 +0300 Subject: [PATCH] Bug fix for multi-table delete with test case and manual entry --- Docs/manual.texi | 2 ++ mysql-test/r/multi_update.result | 4 ++++ mysql-test/t/multi_update.test | 18 ++++++++++++++++++ sql/sql_parse.cc | 5 ----- 4 files changed, 24 insertions(+), 5 deletions(-) diff --git a/Docs/manual.texi b/Docs/manual.texi index a0756f95fbc..d1d2b949190 100644 --- a/Docs/manual.texi +++ b/Docs/manual.texi @@ -49343,6 +49343,8 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}. @itemize @bullet @item +Fixed bug in multi-table @code{DELETE} when optimiser uses only indices +@item Fixed that @code{ALTER TABLE table_name RENAME new_table_name} is as fast as @code{RENAME TABLE}. @item diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index 85819d9571d..b31677069af 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -66,3 +66,7 @@ select count(*) from t3 where id3; count(*) 0 drop table t1,t2,t3; +create table t1(id1 int not null auto_increment primary key, t varchar(100)); +create table t2(id2 int not null, t varchar(100), index(id2)); +delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100; +drop table t1,t2; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index c16189168d2..0c906e56230 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -62,3 +62,21 @@ select count(*) from t2 where id2; select count(*) from t3 where id3; drop table t1,t2,t3; +create table t1(id1 int not null auto_increment primary key, t varchar(100)); +create table t2(id2 int not null, t varchar(100), index(id2)); +disable_query_log; +let $1 = 1000; +while ($1) + { + let $2 = 5; + eval insert into t1(t) values ('aaaaaaaaaaaaaaaaaaaa'); + while ($2) + { + eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb'); + dec $2; + } + dec $1; + } +enable_query_log; +delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100; +drop table t1,t2; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index e2d0c64537d..6253058549e 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1963,11 +1963,6 @@ mysql_execute_command(void) (void)add_item_to_list(new Item_field(auxi->db,auxi->real_name,"*")); } tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege); - if (add_item_to_list(new Item_null())) - { - res= -1; - break; - } thd->proc_info="init"; if ((res=open_and_lock_tables(thd,tables))) break;