diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index b31677069af1aeb6843953e7dd10fa12d3df52b2..e662291625208b375dfc40d191f44e0825e8ea13 100644 --- a/mysql-test/r/multi_update.result +++ b/mysql-test/r/multi_update.result @@ -66,7 +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; +create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1; +create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1; +delete t1 from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500; drop table t1,t2; diff --git a/mysql-test/t/multi_update.test b/mysql-test/t/multi_update.test index 0c906e56230b36cba7bd269b6788af32b2728a87..dc4d444d463c28ad1e8fe49809d636c4371f8940 100644 --- a/mysql-test/t/multi_update.test +++ b/mysql-test/t/multi_update.test @@ -62,14 +62,14 @@ 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)); +create table t1(id1 int not null primary key, t varchar(100)) pack_keys = 1; +create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1; disable_query_log; let $1 = 1000; while ($1) { let $2 = 5; - eval insert into t1(t) values ('aaaaaaaaaaaaaaaaaaaa'); + eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa'); while ($2) { eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb'); @@ -78,5 +78,5 @@ while ($1) dec $1; } enable_query_log; -delete t1, t2 from t2,t1 where t1.id1 = t2.id2 and t1.id1 > 100; +delete t1 from t1,t2 where t1.id1 = t2.id2 and t1.id1 > 500; drop table t1,t2; diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 5f6cce147b7ae5d9063cc565050d4029a8117238..78df12c3606710855c44412223021900254a1571 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -273,11 +273,11 @@ multi_delete::initialize_tables(JOIN *join) if (tab->table->map & tables_to_delete_from) { /* We are going to delete from this table */ - walk->table=tab->table; + TABLE *tbl=walk->table=tab->table; + tbl->no_keyread=1; + tbl->used_keys=0; walk=walk->next; - if (tab == join->join_tab) - tab->table->no_keyread=1; - if (!not_trans_safe && !tab->table->file->has_transactions()) + if (!not_trans_safe && !tbl->file->has_transactions()) not_trans_safe=true; } } diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 575aea5c947080d8c76ca26f639b54abf8d1be8a..7015ce3f98b10ccf44f19f1898c111a7af3f3d33 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -151,6 +151,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length) lex->yacc_yyss=lex->yacc_yyvs=0; lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE); lex->slave_thd_opt=0; + lex->sql_command=SQLCOM_END; bzero(&lex->mi,sizeof(lex->mi)); return lex; } diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 161077bebae614d5b201bad74a4cad95011b2199..3af7588ac65587776d931beac87bddcc411850f1 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1960,7 +1960,11 @@ mysql_execute_command(void) } auxi->lock_type=walk->lock_type=TL_WRITE; auxi->table= (TABLE *) walk; // Remember corresponding table - (void)add_item_to_list(new Item_field(auxi->db,auxi->real_name,"*")); + } + if (add_item_to_list(new Item_null())) + { + res = -1; + break; } tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege); thd->proc_info="init";