3312
MySQLERRORNotableSpatial / GISHIGH confidence

No usable geographic CRS found for the operation

Production Risk

Low — query fails; no data is modified.

How to reproduce
trigger — this will error
trigger — this will error
SELECT ST_Distance(ST_GeomFromText('POINT(0 0)', 3857), ST_GeomFromText('POINT(1 1)', 3857));

expected output

ERROR 3312 (HY000): There is no usable geographic CRS for the geometry.

Fix

Switch to a geographic CRS

Switch to a geographic CRS
SELECT ST_Distance(ST_GeomFromText('POINT(0 0)', 4326), ST_GeomFromText('POINT(1 1)', 4326));

Why this works

SRID 4326 is a geographic CRS supported by all geographic functions.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3312 ER_SRS_NO_USABLE_GEOGRAPHIC_CRS

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

← All MySQL errors