3145
MySQLERRORNotableSpatialHIGH confidence
ST_Union function not implemented for this geometry type
Production Risk
Low — query fails at runtime.
What this means
The ST_Union() function does not support the supplied geometry type, or the geometry type combination is not implemented.
Why it happens
- 1Calling ST_Union() with an unsupported geometry type such as GeometryCollection.
How to reproduce
trigger — this will error
trigger — this will error
SELECT ST_Union(ST_GeomFromText('GEOMETRYCOLLECTION EMPTY'), ST_GeomFromText('POINT(0 0)'));expected output
ERROR 3145 (HY000): st_union not implemented for 'GeometryCollection'.
Fix
Use supported geometry types
Use supported geometry types
SELECT ST_Union(ST_GeomFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'), ST_GeomFromText('POLYGON((2 2,2 7,7 7,7 2,2 2))'));Why this works
ST_Union works correctly with POLYGON and MULTIPOLYGON types.
What not to do
✕
Sources
Official documentation ↗
MySQL 8.0 — 3145 ER_SPATIAL_UNION_NOT_IMPLEMENTED
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev