ENUM
and SET
In MySQL 4.x ENUM
is not a real constrain but a more efficient
way to store fields that can only contain a given set of values.
This is because of the same reasons NOT NULL
is not honoured.
See section 1.8.5.2 Constraint NOT NULL
and DEFAULT
values.
If you insert an wrong value in an ENUM
field, it will be set to
the reserved enum number 0
, which will be displayed as an empty
string in string context. See section 6.2.3.3 The ENUM
Type.
If you insert an wrong option in a SET
field, the wrong value
will be ignored. See section 6.2.3.4 The SET
Type.