1964
MariaDBERRORNotableQueryHIGH confidence

Spatial column %s is not defined

Production Risk

Low — DDL is rejected.

What this means

A spatial function or spatial index operation references a column that is not defined as a spatial/geometry type.

Why it happens
  1. 1Calling ST_GeomFromText or another spatial function on a non-geometry column.
  2. 2Creating a SPATIAL INDEX on a column that is not declared as a geometry type.
How to reproduce
trigger — this will error
trigger — this will error
CREATE SPATIAL INDEX idx ON t(name); -- name is VARCHAR, not geometry

expected output

ERROR 1964 (HY000): Spatial column 'name' is not defined.

Fix

Declare the column as a geometry type before creating a spatial index

Declare the column as a geometry type before creating a spatial index
ALTER TABLE t ADD COLUMN geom GEOMETRY NOT NULL SRID 4326;
CREATE SPATIAL INDEX idx ON t(geom);

Why this works

Spatial indexes require the indexed column to be a spatial data type (GEOMETRY, POINT, LINESTRING, POLYGON, etc.).

Sources
Official documentation ↗

MySQL 8.0 — 1964 ER_GEOMETRY_NOT_DEFINED

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

← All MariaDB errors