Bug #5232 CREATE TABLE ... SELECT can deadlock itself
Submitted: 26 Aug 2004 15:41 Modified: 2 Sep 2004 14:37
Reporter: Tobias Asplund Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:4.0 OS:Any (Any)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[26 Aug 2004 15:41] Tobias Asplund
Description:
In a certain case you can have a CREATE TABLE ... SELECT statement deadlock itself and have it waiting indefinately for itself with status LOCKED in a SHOW PROCESSLIST.

The example is probably not too common, but might be other ways to trigger this with the same command.

How to repeat:
CREATE TABLE a1 ( a INT) ENGINE = MyISAM;
-- Query OK, 0 rows affected (0.11 sec)

CREATE TABLE a2 ( a INT) ENGINE = MyISAM;
-- Query OK, 0 rows affected (0.10 sec)

CREATE TABLE aa ENGINE = MERGE UNION = (a1, a2) SELECT * FROM a1 WHERE 1 = 0;
[2 Sep 2004 14:37] Ramil Kalimullin
Thank you for your bug report. This issue has been committed to our
source repository of that product and will be incorporated into the
next release.

If necessary, you can access the source repository and build the latest
available version, including the bugfix, yourself. More information 
about accessing the source trees is available at
    http://www.mysql.com/doc/en/Installing_source_tree.html