Bug #1860 crash when doing multi-table-updates with constants in where-clause
Submitted: 17 Nov 2003 5:03 Modified: 13 Dec 2003 14:09
Reporter: Thomas Mayer Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.0.16 OS:Linux (Suse Linux 8.2)
Assigned to: Igor Babaev CPU Architecture:Any

[17 Nov 2003 5:03] Thomas Mayer
Description:
When doing multi-table-updates in combination with constants in a where clause, mysql crashes.

How to repeat:
drop table if exists t1;
create table t1(
id1 smallint(5),
field char(5));

drop table if exists t2;
create table t2(
id2 smallint(5),
field char(5));

update t2
	inner join t1 on t1.id1=t2.id2
set t2.field=t1.field
where 0=1;

Suggested fix:
mysql should not crash ;-|

But using constants should be possible im updates as well.
[13 Dec 2003 14:09] Igor Babaev
Fixed in 4.0.17 (in sql_update.cc).  
A similar bug I found for multi-table deletes.  
The fix for deletes was a slightly more complicated, as required to introduce 
a new member 'found' in the class multi_delete - similar to that in 
multi-update (see sql_class.h, sql_delete.cc). 
Thanks to Sinisa who propmted to use the found member of multi_update.