3106
MySQLERRORNotableSchemaHIGH confidence
Unsupported action on generated column
Production Risk
Low — DDL fails; no table is created.
What this means
The attempted operation on a generated column is not supported, such as using it in a way that violates generated column rules.
Why it happens
- 1Referencing a column defined after the generated column in the same table expression.
- 2Using a non-deterministic function in a stored generated column expression.
How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (a INT, b INT GENERATED ALWAYS AS (c + 1) STORED, c INT);
expected output
ERROR 3106 (HY000): 'Forward references to columns' is not supported for generated columns.
Fix
Reorder columns so the referenced column comes before the generated column
Reorder columns so the referenced column comes before the generated column
CREATE TABLE t (a INT, c INT, b INT GENERATED ALWAYS AS (c + 1) STORED);
Why this works
Generated columns can only reference columns defined earlier in the table.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3106 ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev