Answer the question
In order to leave comments, you need to log in
STRICT_TRANS_TABLES does not work in MySQL. Why?
The server's global and session modes are set to STRICT_TRANS_TABLES, meaning the database is in strict mode. But as you can see in the MySQL 5.7 terminal screen above, the table (InnoDB) behaves like it is in non-strict mode: insert with an omitted value for an ENUM field with NOT NULL should throw an error, but in fact this field is assigned the default value for this type data - the first value from the list for this ENUM field.
What's wrong?
Answer the question
In order to leave comments, you need to log in
This is the correct behavior as described in the documentation https://dev.mysql.com/doc/refman/5.7/en/enum.html
There are no exceptions for strict mode.
strict mode will only give an error if the value is invalid (NULL is not one of those).
If strict SQL mode is enabled, attempts to insert invalid ENUM values result in an error.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question