3613
MariaDBERRORNotableSpatialHIGH confidence

Spatial index expression not allowed here

Production Risk

Low — DDL fails; no data is affected.

How to reproduce
trigger — this will error
trigger — this will error
CREATE TABLE t (g GEOMETRY NOT NULL SRID 4326, INDEX ((ST_X(g))));

expected output

ERROR 3613 (HY000): Spatial index function not allowed.

Fix

Use SPATIAL INDEX

Use SPATIAL INDEX
CREATE TABLE t (g GEOMETRY NOT NULL SRID 4326, SPATIAL INDEX(g));

Why this works

Creates a proper R-tree spatial index rather than a functional B-tree index.

What not to do

Version notes

Sources
Official documentation ↗

MySQL 8.0 — 3613 ER_SPATIAL_INDEX_FUNCTION_NOT_ALLOWED

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

← All MariaDB errors