Bug #8392 reference in 'delete from foo where id>0 order by foo.id' crashes server

Submitted: 9 Feb 2005 13:03 Modified: 21 Feb 2005 18:58
Reporter: Anders Henke Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S2 (Serious)
Version:4.0.24, 4.1.9, 5.0.2 OS:Linux (Linux)
Assigned to: Igor Babaev CPU Architecture:Any

[9 Feb 2005 13:03] Anders Henke
Description:
Deleting using a reference to the same tabel with 'order by table.field' crashes the MySQL server with segfault/signal 11.

How to repeat:
CREATE TABLE `foo` (
  `LOGID` int(10) unsigned NOT NULL auto_increment,
  `MID` int(10) unsigned NOT NULL default '0',
  `Datum` timestamp(10) NOT NULL,
  `Query` blob NOT NULL,
  PRIMARY KEY  (`LOGID`)

DELETE from foo WHERE LOGID > 0 ORDER BY foo.LOGID;

->Segfault. Verified using the Official MySQL RPMs of 4.0.23 as well as 4.1.9.

Running the "virtually the same" query
DELETE from foo WHERE LOGID > 0 ORDER BY LOGID;
doesn't crash the server.

Suggested fix:
Make it work ;-)
[9 Feb 2005 13:34] MySQL Verification Team
Thank you for the bug report I was able to repeat with current
BK 4.1 source tree.
[17 Feb 2005 1:59] Igor Babaev
ChangeSet
  1.2060 05/02/15 18:45:42 igor@rurik.mysql.com +3 -0
  delete.result, delete.test:
    Added a test case for bug #8392.
  sql_delete.cc:
    Fixed bug #8392.
    The bug caused a crash for a delete statement with ORDER BY
    that explicitly referred to the modified table.

The crash was due to the fact that tables.alias was not set up in the mysql_delete function.
I checked that in the mysql_update function this field was set up.

The patch was merged into 4.1 and 5.0
[21 Feb 2005 18:58] Paul DuBois
Mentioned in 4.0.24, 4.1.10, 5.0.3 change notes.
[30 Sep 2005 20:51] MySQL Verification Team
See bug:

http://bugs.mysql.com/bug.php?id=13670

Portions of this website are copyright © 2001, 2002 The PHP Group

Page generated in 0.055 sec. using MySQL 8.4.7-u6-cloud

Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.