ST_Validate(g)

Validates a geometry according to the OGC specification. A geometry can
be syntactically well-formed (WKB value plus SRID) but geometrically
invalid. For example, this polygon is geometrically invalid: POLYGON((0
0, 0 0, 0 0, 0 0, 0 0))

ST_Validate() returns the geometry if it is syntactically well-formed
and is geometrically valid, NULL if the argument is not syntactically
well-formed or is not geometrically valid or is NULL.

ST_Validate() can be used to filter out invalid geometry data, although
at a cost. For applications that require more precise results not
tainted by invalid data, this penalty may be worthwhile.

If the geometry argument is valid, it is returned as is, except that if
an input Polygon or MultiPolygon has clockwise rings, those rings are
reversed before checking for validity. If the geometry is valid, the
value with the reversed rings is returned.

The only valid empty geometry is represented in the form of an empty
geometry collection value. ST_Validate() returns it directly without
further checks in this case.

ST_Validate() works only for the Cartesian coordinate system and
requires a geometry argument with an SRID of 0. An ER_WRONG_ARGUMENTS
(https://dev.mysql.com/doc/mysql-errors/5.7/en/server-error-reference.html
#error_er_wrong_arguments) error occurs otherwise.

URL: https://dev.mysql.com/doc/refman/5.7/en/spatial-convenience-functions.html

