3359
MySQLERRORNotableDDL / IndexesHIGH confidence
Functional index data column is itself a functional (generated) column
Production Risk
Low — DDL fails; no index is created.
How to reproduce
trigger — this will error
trigger — this will error
-- Attempting to create a functional index on a column that is itself a hidden generated column.
expected output
ERROR 3359 (HY000): The expression of a functional index cannot refer to a functional index data column.
Fix
Reference base columns only
Reference base columns only
CREATE INDEX idx ON t ((UPPER(real_column)));
Why this works
Functional index expressions must reference physical base columns to avoid circular generated-column dependencies.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3359 ER_FUNCTIONAL_INDEX_DATA_IS_FUNCTIONAL
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev