Bug #67 Bad error message with Multi-table DELETE and Foreign Key
Submitted: 13 Feb 2003 1:24 Modified: 3 Mar 2003 6:00
Reporter: Alexander Keremidarski Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:4.0.10 OS:
Assigned to: Heikki Tuuri CPU Architecture:Any

[13 Feb 2003 1:24] Alexander Keremidarski
Description:
ERROR 1105: Unknown error
after issuing a multi-table delete on parent/child table with FOREIGN KEY.

Note: 4.1 works fine - no ERROR

mysql> delete parent,child from parent,child where parent.id=child.parent_id;
Query OK, 2 rows affected (0.05 sec)

How to repeat:
drop table if exists parent;
drop table if exists child;

CREATE TABLE parent(id INT NOT NULL,
                      PRIMARY KEY (id)) TYPE=INNODB;
CREATE TABLE child(id  INT PRIMARY KEY, parent_id INT,
                      INDEX par_ind (parent_id),
                      FOREIGN KEY (parent_id) REFERENCES parent(id)
                      ON DELETE CASCADE
) TYPE=INNODB; 

insert into parent set id=1;
insert into child set id=1, parent_id=1;

delete parent,child from parent,child where parent.id=child.parent_id;
ERROR 1105: Unknown error
[3 Mar 2003 6:00] Michael Widenius
Thank you for your bug report. This issue has already been fixed
in the latest released version of that product, which you can download at 
http://www.mysql.com/downloads/