Bug #68370 ENUM with NOT NULL, allows NULL / empty string
Submitted: 13 Feb 2013 18:23 Modified: 13 Feb 2013 20:01
Reporter: Roberto Caiola Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Parser Severity:S3 (Non-critical)
Version:5.5 OS:Any
Assigned to: CPU Architecture:Any

[13 Feb 2013 18:23] Roberto Caiola
Description:
We were seeing the backup/restore failing and were not seeing exactly why..

We had a situation that we inserted records without specifying an ENUM "status" and it later crashed backup/restore.

How to repeat:
Quick example:

-- ----------------------------
-- Table structure for `status`
-- ----------------------------
DROP TABLE IF EXISTS `status`;
CREATE TABLE `status` (
  `id_auto` int(11) NOT NULL AUTO_INCREMENT,
  `my_status` enum('Active','Inactive') NOT NULL,
  PRIMARY KEY (`id_auto`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8;

-- ----------------------------
-- Records of status
-- ----------------------------
INSERT INTO `status` VALUES ('1', 'Active');
INSERT INTO `status` VALUES ('2', 'Inactive');

-- ----------------------------
-- This should not be allowed
-- ----------------------------
INSERT IGNORE INTO status (my_status) VALUES (NULL);

-- ----------------------------
SELECT * FROM status;
-- ----------------------------
1	Active
2	Inactive
3	
-- ----------------------------

Suggested fix:
Enforce ENUM rules and NOT NULL
[13 Feb 2013 20:01] MySQL Verification Team
Hello Roberto,

Thank you for the report.

Verified as described on MySQL 5.5.30.

Thanks,
Umesh