3355
MariaDBERRORNotableDDL / IndexesHIGH confidence

Function is not allowed in a functional index expression

Production Risk

Low — DDL fails; no index is created.

How to reproduce
trigger — this will error
trigger — this will error
CREATE INDEX idx ON t ((NOW()));

expected output

ERROR 3355 (HY000): Function or expression is not allowed for functional index.

Fix

Use a deterministic function

Use a deterministic function
CREATE INDEX idx ON t ((YEAR(created_at)));

Why this works

YEAR() is deterministic and produces a stable integer key.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3355 ER_FUNCTIONAL_INDEX_FUNCTION_IS_NOT_ALLOWED

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

← All MariaDB errors