error occurs. If any ring is not in the correct order (exterior ring must be counter-clockwise), an ER_INVALID_CAST_POLYGON_RING_DIRECTION  error occurs. 

•If the expression to cast is a well-formed geometry of type MultiPolygon , the function result is that MultiPolygon . 

•If the expression to cast is a well-formed geometry of type GeometryCollection  containing only polygons, the function result is a MultiPolygon  containing those polygons. If the expression is empty or contains other geometry types, an ER_INVALID_CAST_TO_GEOMETRY  error occurs. 

•If the expression to cast is a well-formed geometry of type other than Polygon , MultiLineString , MultiPolygon , or GeometryCollection , an ER_INVALID_CAST_TO_GEOMETRY  error occurs. 

## Conditions for Casts to GeometryCollection 

These conditions apply when the cast result type is GeometryCollection : 

• GeometryCollection  and GeomCollection  are synonyms for the same result type. 

•If the expression to cast is a well-formed geometry of type Point , the function result is a GeometryCollection  containing that Point  as its sole element. 

•If the expression to cast is a well-formed geometry of type LineString , the function result is a GeometryCollection  containing that LineString  as its sole element. 

•If the expression to cast is a well-formed geometry of type Polygon , the function result is a GeometryCollection  containing that Polygon  as its sole element. 

•If the expression to cast is a well-formed geometry of type MultiPoint , the function result is a GeometryCollection  containing the points in the order they appear in the expression. 

•If the expression to cast is a well-formed geometry of type MultiLineString , the function result is a GeometryCollection  containing the linestrings in the order they appear in the expression. 

•If the expression to cast is a well-formed geometry of type MultiPolygon , the function result is a GeometryCollection  containing the elements of the MultiPolygon  in the order they appear in the expression. 

•If the expression to cast is a well-formed geometry of type GeometryCollection , the function result is that GeometryCollection . 

• TIME 

Produces a TIME  value. 

• UNSIGNED [INTEGER] 

Produces an unsigned integer value. 

• YEAR 

Produces a YEAR  value. Added in MySQL 8.0.22. These rules govern conversion to YEAR : 

•For a four-digit number in the range 1901-2155 inclusive, or for a string which can be interpreted as a four-digit number in this range, return the corresponding YEAR  value. 

