Commit 8a272349 authored by lenz@mysql.com's avatar lenz@mysql.com

Applied Sinisa's patch:

"A fix for non-releasing locks for multi table updates and multi
table deletes with InnoDB tables."
parent 7a6d8edf
...@@ -1058,6 +1058,12 @@ create table t2 (b varchar(10) not null unique) type=innodb; ...@@ -1058,6 +1058,12 @@ create table t2 (b varchar(10) not null unique) type=innodb;
select t1.a from t1,t2 where t1.a=t2.b; select t1.a from t1,t2 where t1.a=t2.b;
a a
drop table t1,t2; drop table t1,t2;
create table t1 (a int not null, b int, primary key (a)) type = innodb;
create table t2 (a int not null, b int, primary key (a)) type = innodb;
insert into t1 values (10, 20);
insert into t2 values (10, 20);
update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
drop table t1,t2;
CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB; CREATE TABLE t1 (id INT NOT NULL, PRIMARY KEY (id)) TYPE=INNODB;
CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) TYPE=INNODB; CREATE TABLE t2 (id INT PRIMARY KEY, t1_id INT, INDEX par_ind (t1_id), FOREIGN KEY (t1_id) REFERENCES t1(id) ON DELETE CASCADE ) TYPE=INNODB;
insert into t1 set id=1; insert into t1 set id=1;
......
...@@ -696,6 +696,12 @@ create table t1 (a varchar(10) not null) type=myisam; ...@@ -696,6 +696,12 @@ create table t1 (a varchar(10) not null) type=myisam;
create table t2 (b varchar(10) not null unique) type=innodb; create table t2 (b varchar(10) not null unique) type=innodb;
select t1.a from t1,t2 where t1.a=t2.b; select t1.a from t1,t2 where t1.a=t2.b;
drop table t1,t2; drop table t1,t2;
create table t1 (a int not null, b int, primary key (a)) type = innodb;
create table t2 (a int not null, b int, primary key (a)) type = innodb;
insert into t1 values (10, 20);
insert into t2 values (10, 20);
update t1, t2 set t1.b = 150, t2.b = t1.b where t2.a = t1.a and t1.a = 10;
drop table t1,t2;
# #
# Test of multi-table-delete with foreign key constraints # Test of multi-table-delete with foreign key constraints
......
...@@ -2038,7 +2038,7 @@ mysql_execute_command(void) ...@@ -2038,7 +2038,7 @@ mysql_execute_command(void)
(ORDER *)NULL,(ORDER *)NULL,(Item *)NULL, (ORDER *)NULL,(ORDER *)NULL,(Item *)NULL,
(ORDER *)NULL, (ORDER *)NULL,
select_lex->options | thd->options | select_lex->options | thd->options |
SELECT_NO_JOIN_CACHE, SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,
result); result);
delete result; delete result;
} }
......
...@@ -400,7 +400,7 @@ int mysql_multi_update(THD *thd, ...@@ -400,7 +400,7 @@ int mysql_multi_update(THD *thd,
res= mysql_select(thd,table_list,total_list, res= mysql_select(thd,table_list,total_list,
conds, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL, conds, (ORDER *) NULL, (ORDER *)NULL, (Item *) NULL,
(ORDER *)NULL, (ORDER *)NULL,
options | SELECT_NO_JOIN_CACHE, options | SELECT_NO_JOIN_CACHE | SELECT_NO_UNLOCK,
result); result);
delete result; delete result;
DBUG_RETURN(res); DBUG_RETURN(res);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment