This topic describes the ST_DumpRings function. This function extracts the outer rings and inner rings of the input polygon object.

Syntax

geometry_dump[]  ST_DumpRings(geometry  aPolygon);

Parameters

Parameter Description
aPolygon The polygon object or that you want to specify.

Description

  • This function returns a set of geometry_dump rows of the input polygon object. Each value of a row contains the geom field and an array of the path field.
    • The path field indicates the indexes of rings. The value 0 indicates the outer ring. A value that is greater than 0 indicates an inner ring.
    • The geom field represents the corresponding ring as a polygon object.
  • This function supports only polygon objects. The MultiPolygon objects are not supported.
  • This function supports 3D objects.

Examples

Results returned by using the default parameter settings:
SELECT (t.dump).path,ST_AsText((t.dump).geom) from (select ST_DumpRings('POLYGON((0 0,0 4,4 4,4 0,0 0),(1 1,2 1,2 2,1 2,1 1))'::geometry) as dump) as t;
 path |           st_astext
------+--------------------------------
 {0}  | POLYGON((0 0,0 4,4 4,4 0,0 0))
 {1}  | POLYGON((1 1,2 1,2 2,1 2,1 1))
(2 rows)