3352
MySQLERRORNotableDML / IndexesHIGH confidence

A row inserted into a functional index cannot produce a NULL key value

Production Risk

Medium — the INSERT/UPDATE is rejected; row is not stored.

How to reproduce
trigger — this will error
trigger — this will error
INSERT INTO t (col) VALUES (NULL); -- functional index on (LOWER(col)) with NOT NULL

expected output

ERROR 3352 (HY000): A row in a functional index contains a NULL value, which is not allowed.

Fix

Insert non-NULL data

Insert non-NULL data
INSERT INTO t (col) VALUES ('value');

Why this works

Providing a non-NULL value ensures the index expression evaluates to a valid key.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3352 ER_FUNCTIONAL_INDEX_ROW_CANNOT_HAVE_NULL

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

← All MySQL errors