Error
Error Code:
3102
MySQL Error 3102: Disallowed Function in Generated Column
Description
This error occurs when attempting to define a generated column whose expression contains a function that is not permitted by MySQL. Generated columns have strict requirements, primarily dictating that their expressions must be deterministic and self-contained.
Error Message
Expression of generated column '%s' contains a disallowed function.
Known Causes
3 known causesUsing Non-Deterministic Functions
Generated columns require deterministic expressions. Functions like RAND() or UUID() whose output can vary for the same input are strictly disallowed.
Invoking Stored Functions/UDFs
MySQL prohibits calling stored functions or user-defined functions (UDFs) directly within the definition of a generated column expression.
Functions Accessing External State
Expressions cannot include functions that rely on session variables, system variables, or other external, non-constant data sources that could change their result.
Solutions
Coming SoonGeneral Troubleshooting Tips
- Check the error message carefully for specific details
- Review recent changes that might have caused the error
- Search for the exact error code in the official documentation
- Check log files for additional context
- Try restarting the application or service