3357
MySQLERRORNotableDDL / IndexesHIGH confidence

Functional index cannot be a spatial index

Production Risk

Low — DDL fails; no index is created.

How to reproduce
trigger — this will error
trigger — this will error
CREATE SPATIAL INDEX sp_idx ON t ((ST_Buffer(geom, 1)));

expected output

ERROR 3357 (HY000): Cannot create a functional index with index type SPATIAL.

Fix

Use a plain SPATIAL index

Use a plain SPATIAL index
CREATE SPATIAL INDEX sp_idx ON t (geom);

Why this works

Spatial indexes require the raw geometry column, not a derived expression.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3357 ER_SPATIAL_FUNCTIONAL_INDEX

Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev

← All MySQL errors