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() handles its arguments as described in the introduction to
this section, with the exceptions listed here:

o If the geometry has a geographic SRS with a longitude or latitude
  that is out of range, an error occurs:

  o If a longitude value is not in the range (−180, 180], an
    ER_GEOMETRY_PARAM_LONGITUDE_OUT_OF_RANGE
    (https://dev.mysql.com/doc/mysql-errors/8.4/en/server-error-referen
    ce.html#error_er_geometry_param_longitude_out_of_range) error
    occurs.

  o If a latitude value is not in the range [−90, 90], an
    ER_GEOMETRY_PARAM_LATITUDE_OUT_OF_RANGE
    (https://dev.mysql.com/doc/mysql-errors/8.4/en/server-error-referen
    ce.html#error_er_geometry_param_latitude_out_of_range) error
    occurs.

  Ranges shown are in degrees. The exact range limits deviate slightly
  due to floating-point arithmetic.

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

