Bug #19441 mysqld crashes on CREATE TABLE...SELECT with ENUM
Submitted: 30 Apr 2006 7:24 Modified: 30 Apr 2006 13:45
Reporter: Nathan Cheng Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:4.1.7 OS:Windows (Windows, Linux)
Assigned to: CPU Architecture:Any

[30 Apr 2006 7:24] Nathan Cheng
Description:
This appears similar to Bug #19145 which has been recently patched, but is different because it also crashes when creating an INNODB table, not just MyISAM.

This bug causes the server to crash, leaving no trace in any log file.

Tested on both Windows and Linux with same result.

How to repeat:
DROP TABLE IF EXISTS a;

# Any one of these queries crashes 4.1.7:

CREATE TABLE a ( a enum('a') default NULL ) SELECT NULL AS a;
CREATE TABLE a ( a enum('a') default NULL ) SELECT 'a' AS a;
CREATE TABLE a ( a enum('a') NULL default NULL ) SELECT 'a' AS a;
CREATE TABLE a ( a enum('a') NULL default 'a' ) SELECT 'a' AS a;
CREATE TABLE a ( a enum('a') NOT NULL default 'a' ) SELECT 'a' AS a;
CREATE TABLE a ( a enum('a') NOT NULL ) SELECT 'a' AS a;
CREATE TABLE a ( a enum('a') ) SELECT 'a' AS a;

# Note that any one of these queries crashes when creating either INNODB or MyISAM. E.g.:

CREATE TABLE a ( a enum('a') NOT NULL default 'a' ) ENGINE=INNODB SELECT 'a' AS a;
[30 Apr 2006 13:45] MySQL Verification Team
Thank you for the bug report. I was unable to repeat the crash with
current source server performing all the queries provided:

miguel@hegel:~/dbs/4.1> bin/mysql -uroot test
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.1.19-debug-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> CREATE TABLE a ( a enum('a') default NULL ) SELECT NULL AS a;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE a ( a enum('a') default NULL ) SELECT 'a' AS a;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE a ( a enum('a') NULL default NULL ) SELECT 'a' AS a;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE a ( a enum('a') NULL default 'a' ) SELECT 'a' AS a;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE a ( a enum('a') NOT NULL default 'a' ) SELECT 'a' AS a;
Query OK, 1 row affected (0.00 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE a ( a enum('a') NOT NULL ) SELECT 'a' AS a;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE a ( a enum('a') ) SELECT 'a' AS a;
Query OK, 1 row affected (0.02 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql> drop table a;
Query OK, 0 rows affected (0.00 sec)

mysql> CREATE TABLE a ( a enum('a') NOT NULL default 'a' ) ENGINE=INNODB SELECT 'a' AS
    -> a;
Query OK, 1 row affected (0.01 sec)
Records: 1  Duplicates: 0  Warnings: 0

mysql>