Bug #41477 | InnoDB foreign keys: wrong result if ON DELETE CASCADE, and correlated subquery | ||
---|---|---|---|
Submitted: | 15 Dec 2008 15:33 | Modified: | 15 Dec 2008 17:11 |
Reporter: | Konstantin Osipov (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S3 (Non-critical) |
Version: | 4.1, 5.0, 5,1, 6.0 bzr | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[15 Dec 2008 15:33]
Konstantin Osipov
[15 Dec 2008 17:11]
Sveta Smirnova
Thank you for the report. Verified as described.
[13 Feb 2012 8:30]
Fayaz Yusuf Khan
I think my issue is also related to this. mysql> create table A (id int primary key, parent_id int, constraint foreign key (parent_id) references A (id) on delete cascade) engine=InnoDB; Query OK, 0 rows affected (0.16 sec) mysql> insert into A(id, parent_id) values (1,1),(2,1); Query OK, 2 rows affected (0.04 sec) Records: 2 Duplicates: 0 Warnings: 0 mysql> select count(*) from A; +----------+ | count(*) | +----------+ | 2 | +----------+ 1 row in set (0.03 sec) mysql> delete from A; Query OK, 1 row affected (0.05 sec) <-- Says only one row affected. mysql> select count(*) from A; +----------+ | count(*) | +----------+ | 0 | +----------+ 1 row in set (0.00 sec)