3276
MySQLERRORNotableGIS / GeometryHIGH confidence

SRS is not a Cartesian coordinate system

Production Risk

Medium — spatial queries fail.

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

expected output

ERROR 3276 (HY000): Function requires a Cartesian spatial reference system, but got geographic SRS 4326.

Fix

Use Cartesian SRS

Use Cartesian SRS
SELECT ST_Distance(ST_GeomFromText('POINT(0 0)', 0), ST_GeomFromText('POINT(1 1)', 0));

Why this works

SRID 0 is the default Cartesian SRS.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3276 ER_SRS_NOT_CARTESIAN

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

← All MySQL errors