3147
MySQLERRORNotableSpatialHIGH confidence

ST_SymDifference function not implemented for this geometry type

Production Risk

Low — query fails at runtime.

What this means

The ST_SymDifference() function (symmetric difference of two geometries) does not support the supplied geometry type combination.

Why it happens
  1. 1Calling ST_SymDifference() with an unsupported geometry type such as GeometryCollection.
How to reproduce
trigger — this will error
trigger — this will error
SELECT ST_SymDifference(ST_GeomFromText('POINT(0 0)'), ST_GeomFromText('POINT(1 1)'));

expected output

ERROR 3147 (HY000): st_symdifference not implemented for 'POINT'.

Fix

Use POLYGON geometry types

Use POLYGON geometry types
SELECT ST_SymDifference(ST_GeomFromText('POLYGON((0 0,0 5,5 5,5 0,0 0))'), ST_GeomFromText('POLYGON((3 3,3 8,8 8,8 3,3 3))'));

Why this works

ST_SymDifference is implemented for POLYGON types.

What not to do

Sources
Official documentation ↗

MySQL 8.0 — 3147 ER_SPATIAL_SYMDIFFERENCE_NOT_IMPLEMENTED

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

← All MySQL errors