mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
A fix for multi-table delete with tables optimised away.
Still not able to make a proper test case as this crashes on files where key and data pointers are 4 bytes each. Possibly a proper test case would require myisampack.
This commit is contained in:
@ -66,7 +66,7 @@ select count(*) from t3 where id3;
|
|||||||
count(*)
|
count(*)
|
||||||
0
|
0
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
create table t1(id1 int not null auto_increment primary key, t varchar(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));
|
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
|
||||||
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;
|
drop table t1,t2;
|
||||||
|
@ -62,14 +62,14 @@ select count(*) from t2 where id2;
|
|||||||
select count(*) from t3 where id3;
|
select count(*) from t3 where id3;
|
||||||
|
|
||||||
drop table t1,t2,t3;
|
drop table t1,t2,t3;
|
||||||
create table t1(id1 int not null auto_increment primary key, t varchar(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));
|
create table t2(id2 int not null, t varchar(100), index(id2)) pack_keys = 1;
|
||||||
disable_query_log;
|
disable_query_log;
|
||||||
let $1 = 1000;
|
let $1 = 1000;
|
||||||
while ($1)
|
while ($1)
|
||||||
{
|
{
|
||||||
let $2 = 5;
|
let $2 = 5;
|
||||||
eval insert into t1(t) values ('aaaaaaaaaaaaaaaaaaaa');
|
eval insert into t1 values ($1,'aaaaaaaaaaaaaaaaaaaa');
|
||||||
while ($2)
|
while ($2)
|
||||||
{
|
{
|
||||||
eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
|
eval insert into t2(id2,t) values ($1,'bbbbbbbbbbbbbbbbb');
|
||||||
@ -78,5 +78,5 @@ while ($1)
|
|||||||
dec $1;
|
dec $1;
|
||||||
}
|
}
|
||||||
enable_query_log;
|
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;
|
drop table t1,t2;
|
||||||
|
@ -273,11 +273,11 @@ multi_delete::initialize_tables(JOIN *join)
|
|||||||
if (tab->table->map & tables_to_delete_from)
|
if (tab->table->map & tables_to_delete_from)
|
||||||
{
|
{
|
||||||
/* We are going to delete from this table */
|
/* 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;
|
walk=walk->next;
|
||||||
if (tab == join->join_tab)
|
if (!not_trans_safe && !tbl->file->has_transactions())
|
||||||
tab->table->no_keyread=1;
|
|
||||||
if (!not_trans_safe && !tab->table->file->has_transactions())
|
|
||||||
not_trans_safe=true;
|
not_trans_safe=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,6 +151,7 @@ LEX *lex_start(THD *thd, uchar *buf,uint length)
|
|||||||
lex->yacc_yyss=lex->yacc_yyvs=0;
|
lex->yacc_yyss=lex->yacc_yyvs=0;
|
||||||
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
|
lex->ignore_space=test(thd->sql_mode & MODE_IGNORE_SPACE);
|
||||||
lex->slave_thd_opt=0;
|
lex->slave_thd_opt=0;
|
||||||
|
lex->sql_command=SQLCOM_END;
|
||||||
bzero(&lex->mi,sizeof(lex->mi));
|
bzero(&lex->mi,sizeof(lex->mi));
|
||||||
return lex;
|
return lex;
|
||||||
}
|
}
|
||||||
|
@ -1960,7 +1960,11 @@ mysql_execute_command(void)
|
|||||||
}
|
}
|
||||||
auxi->lock_type=walk->lock_type=TL_WRITE;
|
auxi->lock_type=walk->lock_type=TL_WRITE;
|
||||||
auxi->table= (TABLE *) walk; // Remember corresponding table
|
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);
|
tables->grant.want_privilege=(SELECT_ACL & ~tables->grant.privilege);
|
||||||
thd->proc_info="init";
|
thd->proc_info="init";
|
||||||
|
Reference in New Issue
Block a user