diff options
-rw-r--r-- | mysql-test/r/multi_update.result | 6 | ||||
-rw-r--r-- | mysql-test/t/multi_update.test | 8 | ||||
-rw-r--r-- | sql/sql_delete.cc | 8 | ||||
-rw-r--r-- | sql/sql_lex.cc | 1 | ||||
-rw-r--r-- | sql/sql_parse.cc | 6 |
5 files changed, 17 insertions, 12 deletions
diff --git a/mysql-test/r/multi_update.result b/mysql-test/r/multi_update.result index b31677069af..e6622916252 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 0c906e56230..dc4d444d463 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 5f6cce147b7..78df12c3606 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 575aea5c947..7015ce3f98b 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 161077bebae..3af7588ac65 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"; |