1101
MySQLERRORCommonDDLHIGH confidence

BLOB/TEXT/GEOMETRY/JSON column can't have a default value

Production Risk

Low — DDL fails; no data loss.

What this means

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).

Why it happens
  1. 1CREATE TABLE or ALTER TABLE defines a DEFAULT value for a BLOB/TEXT/JSON column
  2. 2ORM generates DEFAULT '' for text columns without checking the column type
How to reproduce
trigger — this will error
trigger — this will error
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.

Remove the DEFAULT clause or use NULL
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.

What not to do

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.

Version notes
MySQL 8.0.13

Expression defaults using parenthesized expressions are allowed for some types, but BLOB/TEXT literal defaults remain forbidden.

Sources
Official documentation ↗

MySQL 8.0 — 1101 ER_BLOB_CANT_HAVE_DEFAULT

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors