3203
MySQLERRORNotableDDLHIGH confidence
Function not allowed in generated column expression
Production Risk
Low — DDL error, no data affected.
Why it happens
- 1Using a non-deterministic function (e.g., NOW(), RAND(), UUID()) in a generated column definition.
- 2Referencing another generated column of a disallowed type.
How to reproduce
trigger — this will error
trigger — this will error
ALTER TABLE t1 ADD COLUMN gen_col VARCHAR(50) AS (UUID()) STORED;
expected output
ERROR 3203 (HY000): The function is not allowed in the expression of a generated column.
Fix
Use only deterministic functions
Use only deterministic functions
ALTER TABLE t1 ADD COLUMN gen_col INT AS (col1 + col2) STORED;
Why this works
Generated columns require deterministic expressions so they can be consistently recalculated.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3203 ER_GENERATED_COLUMN_FUNCTION_IS_NOT_ALLOWED2
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev