3347
MariaDBERRORNotableDDL / IndexesHIGH confidence

Functional index cannot be created on a plain column reference

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 ((col));

expected output

ERROR 3347 (HY000): A functional index cannot be based on a column; use a regular index instead.

Fix 1

Use a function expression

Use a function expression
CREATE INDEX idx ON t ((LOWER(col)));

Why this works

Functional indexes must apply a transformation function to the column.

Fix 2

Or use a regular index

Or use a regular index
CREATE INDEX idx ON t (col);

Why this works

Without parentheses, a plain column index is created normally.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3347 ER_FUNCTIONAL_INDEX_ON_FIELD

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

← All MariaDB errors