Bug #217 bug in multiupdate with subselect
Submitted: 1 Apr 2003 6:49 Modified: 5 Apr 2003 12:23
Reporter: Oleksandr Byelkin Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.1 OS:Any (any)
Assigned to: Oleksandr Byelkin CPU Architecture:Any

[1 Apr 2003 6:49] Oleksandr Byelkin
Description:
multy update crashes with subselect 

How to repeat:
drop table if exists t1,t2; 
CREATE TABLE t1 ( 
  id int(11) default NULL 
) TYPE=MyISAM CHARSET=latin1; 
INSERT INTO t1 VALUES (1); 
INSERT INTO t1 VALUES (1); 
INSERT INTO t1 VALUES (2); 
INSERT INTO t1 VALUES (2); 
INSERT INTO t1 VALUES (1); 
INSERT INTO t1 VALUES (3); 
CREATE TABLE t2 ( 
  id int(11) default NULL, 
  name varchar(15) default NULL 
) TYPE=MyISAM CHARSET=latin1; 
 
INSERT INTO t2 VALUES (4,'vita'); 
INSERT INTO t2 VALUES (1,'vita'); 
INSERT INTO t2 VALUES (2,'vita'); 
INSERT INTO t2 VALUES (1,'vita'); 
update t1, t2 set t2.name='lenka' where t2.id in (select id from t1); 
select * from t2; 
drop table t1,t2; 

Suggested fix:
correctly initialize st_select_lex->with_sum_funcs for multiupdate
[4 Apr 2003 0:12] Oleksandr Byelkin
it appeared multiupdate incompatibilities with any subquery