Example 1 –
The following example construct a geometry collection containing a polygon and a linestring and returns the boundary for the collection. The returned boundary is a collection containing the exterior ring of the polygon and the two end points of the linestring. It is equivalent to the following collection:'GeometryCollection (LineString (0 0, 3 0, 3 3, 0 3, 0 0), MultiPoint ((0 7), (4 4)))'
SELECT NEW ST_GeomCollection('GeometryCollection (Polygon ((0 0, 3 0, 3 3, 0 3, 0 0)), LineString (0 7, 0 4, 4 4))').ST_Boundary()