3144
MySQLERRORNotableSpatialHIGH confidence

ST_Contains function not implemented for this geometry type

Production Risk

Low — query fails at runtime; spatial functions have specific type requirements.

What this means

The ST_Contains() spatial function does not support the supplied geometry type combination. Certain geometry type pairs (e.g., GeometryCollection) are not supported.

Why it happens
  1. 1Calling ST_Contains() with a GeometryCollection or unsupported geometry type.
How to reproduce
trigger — this will error
trigger — this will error
SELECT ST_Contains(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'), ST_GeomFromText('POINT(0 0)'));

expected output

ERROR 3144 (HY000): st_contains not implemented for 'GeometryCollection'.

Fix

Use ST_Within or restructure the geometry types

Use ST_Within or restructure the geometry types
SELECT ST_Within(ST_GeomFromText('POINT(0 0)'), ST_GeomFromText('POLYGON((0 0, 0 10, 10 10, 10 0, 0 0))'));

Why this works

Use supported geometry type combinations.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3144 ER_SPATIAL_CONTAINS_FUNCTION_NOT_IMPLEMENTED

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

← All MySQL errors