BLOB/TEXT/GEOMETRY/JSON column can't have a default value
Production Risk
Low — DDL fails; no data loss.
ER_BLOB_CANT_HAVE_DEFAULT (1101, SQLSTATE HY000) is raised when a BLOB, TEXT, GEOMETRY, or JSON column is defined with a DEFAULT clause. These types cannot have literal default values (NULL is allowed).
- 1CREATE TABLE or ALTER TABLE defines a DEFAULT value for a BLOB/TEXT/JSON column
- 2ORM generates DEFAULT '' for text columns without checking the column type
CREATE TABLE t (content TEXT DEFAULT 'none');
expected output
ERROR 1101 (HY000): BLOB, TEXT, GEOMETRY or JSON column 'content' can't have a default value
Fix
Remove the DEFAULT clause or use NULL
WHEN A TEXT/BLOB column has a DEFAULT value.
CREATE TABLE t (content TEXT DEFAULT NULL); -- or simply: CREATE TABLE t (content TEXT);
Why this works
NULL is the only allowed default for BLOB/TEXT columns; use application logic to supply default values.
✕ Switch TEXT to VARCHAR just to allow a default value
If the column genuinely needs to store large text, VARCHAR has its own length limits; evaluate the data requirements first.
Expression defaults using parenthesized expressions are allowed for some types, but BLOB/TEXT literal defaults remain forbidden.
MySQL 8.0 — 1101 ER_BLOB_CANT_HAVE_DEFAULT
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev