ST_CollectionExtract (A: Geometry)
ST_CollectionExtract (A: Geometry, type: Integer)
WITH test_data as ( ST_GeomFromText( 'GEOMETRYCOLLECTION(POINT(40 10), POLYGON((0 0, 0 5, 5 5, 5 0, 0 0)))' ) as geom ) SELECT ST_CollectionExtract(geom) as c1, ST_CollectionExtract(geom, 1) as c2 FROM test_data
+----------------------------------------------------------------------------+ |c1 |c2 | +----------------------------------------------------------------------------+ |MULTIPOLYGON(((0 0, 0 5, 5 5, 5 0, 0 0))) |MULTIPOINT(40 10) | | +----------------------------------------------------------------------------+
Was this page helpful?