Amazon Redshift will no longer support the use of Python UDFs after June 30, 2026.
We will start enforcing it in phases. For more information on the details of Python end of life
and migration options, see the
blog post
ST_NRings
ST_NRings returns the number of rings in an input geometry.
Syntax
ST_NRings(geom)
Arguments
- geom
-
A value of data type
GEOMETRYor an expression that evaluates to aGEOMETRYtype.
Return type
INTEGER
If geom is null, then null is returned.
The values returned are as follows.
| Returned value | Geometry subtype |
|---|---|
0 |
Returned if geom is a |
The number of rings. |
Returned if geom is a |
The number of rings in all components |
Returned if geom is a |
Examples
The following SQL returns the number of rings in a multipolygon.
SELECT ST_NRings(ST_GeomFromText('MULTIPOLYGON(((0 0,10 0,0 10,0 0)),((0 0,-10 0,0 -10,0 0)))'));
st_nrings
-------------
2