You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: functional index on JSON_EXTRACT expression rejected #32313
Creating a functional (expression) index over a JSON extraction — the standard MySQL 8 pattern for indexing JSON fields — is rejected with a misleading error claiming the expression is not session-independent, although JSON_EXTRACT + CAST is fully deterministic.
Repro
CREATETABLEjc (id INTPRIMARY KEY, j JSON,
KEY idx_g ((CAST(JSON_EXTRACT(j,'$.g') ASINT))));
-- ERROR 20105 (HY000): not supported: functional index expression-- must have session-independent semantics
MySQL 8.0 supports this natively (both via functional index on (CAST(...)) and via the generated-column + index pattern), and it is the canonical way to index into JSON documents.
The error message is also misleading: the expression is session-independent — the rejection is really "functional indexes on this expression are not implemented", which makes users think they wrote something semantically wrong.
Workarounds checked
None within DDL; the only option is maintaining a duplicated plain column + index at the application level.
Version
8.0.30-MatrixOne-v1.3.0 (standalone local cluster, macOS)
Consolidated into #31448, which tracks deterministic functional-index expressions rejected by the shared eligibility whitelist. Your JSON_EXTRACT + CAST DDL repro is preserved as a distinct acceptance case. Generated-column index matching (#32113) and unique functional-index support (#31442) remain separate; this administrative closure does not mean the JSON expression is supported.
Activity
XuPeng-SH commentedon Nov 9, 2026
Consolidated into #31448, which tracks deterministic functional-index expressions rejected by the shared eligibility whitelist. Your JSON_EXTRACT + CAST DDL repro is preserved as a distinct acceptance case. Generated-column index matching (#32113) and unique functional-index support (#31442) remain separate; this administrative closure does not mean the JSON expression is supported.