2
2 Comments

You learn something new every day.

So I was debugging a part of my project late last night and came across this nugget.

I did not know that MySQL required fields to have a default value if they were set to NOT NULL. Has this always been the case?

(added to my things to remember)

Do you have any nuggets of information to share from your debug sessions?

on April 14, 2021
  1. 2

    This doesn’t sound right... what version MySQL, what storage engine, and what data type was the column?

    The “Implicit Default Handling” section suggests a column can be defined as NOT NULL with no explicit DEFAULT clause:
    https://dev.mysql.com/doc/refman/8.0/en/data-type-defaults.html

  2. 1

    MySQL - 5.7.33
    Storage - InnoDB

    All the columns in question are VARCHAR.

    Yeah I know it doesn't sound right, that's the first time I've come across the error.